317 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			317 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.ComponentModel;
 | 
						|
using System.Data;
 | 
						|
using System.Drawing;
 | 
						|
using System.Text;
 | 
						|
using System.Windows.Forms;
 | 
						|
using DevComponents;
 | 
						|
using DevComponents.DotNetBar.Rendering;
 | 
						|
using DevComponents.DotNetBar;
 | 
						|
using VEPROMS.Properties;
 | 
						|
using Volian.Base.Library;
 | 
						|
using DescriptiveEnum;
 | 
						|
using VEPROMS.CSLA.Library;
 | 
						|
 | 
						|
namespace VEPROMS
 | 
						|
{
 | 
						|
	public partial class frmSysOptions : DevComponents.DotNetBar.Office2007Form
 | 
						|
	{
 | 
						|
		bool _initializing;
 | 
						|
    private bool _CanChangeSeparateWindowsSetting = true;
 | 
						|
 | 
						|
    public bool CanChangeSeparateWindowsSetting
 | 
						|
    {
 | 
						|
      get { return _CanChangeSeparateWindowsSetting; }
 | 
						|
      set { _CanChangeSeparateWindowsSetting = value; }
 | 
						|
    }
 | 
						|
 | 
						|
		private UserSettings _usersettings;
 | 
						|
 | 
						|
		public frmSysOptions()
 | 
						|
		{
 | 
						|
			_initializing = true;
 | 
						|
			InitializeComponent();
 | 
						|
			CurrentSettings();
 | 
						|
			SaveStartingSettings();
 | 
						|
			cbPropGrid.Visible = VlnSettings.DebugMode;
 | 
						|
			btnGeneral.PerformClick();
 | 
						|
			_initializing = false;
 | 
						|
		}
 | 
						|
 | 
						|
		/// <summary>
 | 
						|
		/// Check the proper buttons with respect to the current settings
 | 
						|
		/// </summary>
 | 
						|
		private void CurrentSettings()
 | 
						|
		{
 | 
						|
			switch (Settings.Default.PropPageStyle)
 | 
						|
			{
 | 
						|
				case 1: cbButtonIntrFace.Checked = true;
 | 
						|
					break;
 | 
						|
				case 2: cbTabbedIntrFace.Checked = true;
 | 
						|
					break;
 | 
						|
				case 3: cbPropGrid.Checked = true;
 | 
						|
					break;
 | 
						|
			}
 | 
						|
			switch (Settings.Default.SystemColor)
 | 
						|
			{
 | 
						|
				case (int)eOffice2007ColorScheme.Black:
 | 
						|
					cbRibonBlack.Checked = true;
 | 
						|
					break;
 | 
						|
				case (int)eOffice2007ColorScheme.Blue:
 | 
						|
					cbRibonBlue.Checked = true;
 | 
						|
					break;
 | 
						|
				case (int)eOffice2007ColorScheme.Silver:
 | 
						|
					cbRibonSilver.Checked = true;
 | 
						|
					break;
 | 
						|
			}
 | 
						|
			colorPickerButton1.SelectedColor = Settings.Default.TransitionRangeColor;
 | 
						|
			cbAnnotationPopup.Checked = Settings.Default.AutoPopUpAnnotations;
 | 
						|
			cbStepTypeToolTip.Checked = Settings.Default.StepTypeToolTip;
 | 
						|
			cbShwRplWrdsColor.Checked = Settings.Default.cbShwRplWrdsColor;
 | 
						|
			cbTVExpand.Checked = Settings.Default.SaveTreeviewExpanded;
 | 
						|
			cbPasteNoReturns.Checked = Settings.Default.PasteNoReturns;
 | 
						|
			cbPastePlainText.Checked = Settings.Default.PastePlainText;
 | 
						|
			cbEnhancedDocumentSync.Checked = Settings.Default.SyncEnhancedDocuments;
 | 
						|
			cbSeparateWindows.Checked = Settings.Default.SeparateWindows;
 | 
						|
			txbxVisioPath.Text = Settings.Default.VisioPath;
 | 
						|
 | 
						|
			//CSM - C2024-031 - Getting User Settings
 | 
						|
			//and set checkboxes based on what they are set to
 | 
						|
			_usersettings = new UserSettings(VlnSettings.UserID);
 | 
						|
			cbOTRemember.Checked = _usersettings.UserSetting_OpenTabs_Remember;
 | 
						|
			cbOTAutoOpen.Enabled = cbOTAutoOpen.Visible = cbOTRemember.Checked;
 | 
						|
			cbOTAutoOpen.Checked = _usersettings.UserSetting_OpenTabs_AutoOpen || !cbOTRemember.Checked;
 | 
						|
 | 
						|
			//C2025-013 - Allow not continuously generate message that opening Summaries in MS Word
 | 
						|
			cbMSWordPrompt.Checked = _usersettings.UserSetting_MSWord_Summary_Prompt;
 | 
						|
		}
 | 
						|
		private void cbEnhancedDocumentSync_CheckedChanged(object sender, System.EventArgs e)
 | 
						|
		{
 | 
						|
			if (!_initializing)
 | 
						|
			{
 | 
						|
				Settings.Default.SyncEnhancedDocuments = cbEnhancedDocumentSync.Checked;
 | 
						|
			}
 | 
						|
		}
 | 
						|
		private void cbPastePlainText_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			if (!_initializing)
 | 
						|
			{
 | 
						|
				Settings.Default.PastePlainText = cbPastePlainText.Checked;
 | 
						|
			}
 | 
						|
		}
 | 
						|
	
 | 
						|
		private void cbPasteNoReturns_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			if (!_initializing)
 | 
						|
			{
 | 
						|
				Settings.Default.PasteNoReturns = cbPasteNoReturns.Checked;
 | 
						|
			}
 | 
						|
		}
 | 
						|
		private void cbRibonBlue_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			if (!_initializing)
 | 
						|
			{
 | 
						|
				RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable(eOffice2007ColorScheme.Blue);
 | 
						|
				Settings.Default.SystemColor = (int)eOffice2007ColorScheme.Blue;
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		private void cbRibonSilver_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			if (!_initializing)
 | 
						|
			{
 | 
						|
				RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable(eOffice2007ColorScheme.Silver);
 | 
						|
				Settings.Default.SystemColor = (int)eOffice2007ColorScheme.Silver;
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		private void cbRibonBlack_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			if (!_initializing)
 | 
						|
			{
 | 
						|
				RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable(eOffice2007ColorScheme.Black);
 | 
						|
				Settings.Default.SystemColor = (int)eOffice2007ColorScheme.Black;
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		private void btnOK_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			// Save Default settings for User
 | 
						|
			
 | 
						|
			// Property Page style
 | 
						|
			if (cbButtonIntrFace.Checked)
 | 
						|
				Settings.Default.PropPageStyle = 1;
 | 
						|
			else if (cbTabbedIntrFace.Checked)
 | 
						|
				Settings.Default.PropPageStyle = 2;
 | 
						|
			else if (cbPropGrid.Checked)
 | 
						|
				Settings.Default.PropPageStyle = 3;
 | 
						|
 | 
						|
			Settings.Default.Save();
 | 
						|
			//CSM - C2024-031 - Save User Settings
 | 
						|
			//based on what checkboxes are set to
 | 
						|
			bool? OTAuto = null;
 | 
						|
			if (cbOTRemember.Checked)
 | 
						|
            {
 | 
						|
                OTAuto = cbOTAutoOpen.Checked;
 | 
						|
            }
 | 
						|
            _usersettings.SetUserSettings(cbOTRemember.Checked, OTAuto);
 | 
						|
 | 
						|
			//C2025-013 - Allow not continuously generate message that opening Summaries in MS Word
 | 
						|
			_usersettings.SetUserSetting_MSWord_Summary_Prompt(cbMSWordPrompt.Checked);
 | 
						|
 | 
						|
			this.DialogResult = DialogResult.OK;
 | 
						|
			this.Close();
 | 
						|
		}
 | 
						|
 | 
						|
		private int ss_propPageStyle;
 | 
						|
		private	int ss_SystemColor;
 | 
						|
		private	Color ss_TransRangeColor;
 | 
						|
		private	bool ss_PopUPAnnotations;
 | 
						|
		private	bool ss_StepTypeToolTip;
 | 
						|
		private bool ss_cbShwRplWrdsColor;
 | 
						|
		private	bool ss_SaveTreeviewExpanded;
 | 
						|
		private	bool ss_PasteNoReturns;
 | 
						|
		private	bool ss_PastePlainText;
 | 
						|
		private	bool ss_SyncEnhancedDocuments;
 | 
						|
		private	bool ss_SeparateWindows;
 | 
						|
		private	string ss_VisioPath;
 | 
						|
 | 
						|
		private void SaveStartingSettings()
 | 
						|
		{
 | 
						|
			ss_propPageStyle = Settings.Default.PropPageStyle;
 | 
						|
			ss_SystemColor = Settings.Default.SystemColor;
 | 
						|
			ss_TransRangeColor = Settings.Default.TransitionRangeColor;
 | 
						|
			ss_PopUPAnnotations = Settings.Default.AutoPopUpAnnotations;
 | 
						|
			ss_StepTypeToolTip = Settings.Default.StepTypeToolTip;
 | 
						|
 | 
						|
			ss_cbShwRplWrdsColor = Settings.Default.cbShwRplWrdsColor;
 | 
						|
			ss_SaveTreeviewExpanded = Settings.Default.SaveTreeviewExpanded;
 | 
						|
			ss_PasteNoReturns = Settings.Default.PasteNoReturns;
 | 
						|
			ss_PastePlainText = Settings.Default.PastePlainText;
 | 
						|
			ss_SyncEnhancedDocuments = Settings.Default.SyncEnhancedDocuments;
 | 
						|
			ss_SeparateWindows = Settings.Default.SeparateWindows;
 | 
						|
			ss_VisioPath = Settings.Default.VisioPath;
 | 
						|
		}
 | 
						|
 | 
						|
		private void RestoreStartingSettings() // used with the cancel button
 | 
						|
		{
 | 
						|
			Settings.Default.PropPageStyle = ss_propPageStyle;
 | 
						|
			 Settings.Default.SystemColor = ss_SystemColor;
 | 
						|
			Settings.Default.TransitionRangeColor = ss_TransRangeColor;
 | 
						|
			Settings.Default.AutoPopUpAnnotations = ss_PopUPAnnotations;
 | 
						|
			Settings.Default.StepTypeToolTip = ss_StepTypeToolTip;
 | 
						|
			Settings.Default.cbShwRplWrdsColor = ss_cbShwRplWrdsColor;
 | 
						|
			Settings.Default.SaveTreeviewExpanded = ss_SaveTreeviewExpanded;
 | 
						|
			Settings.Default.PasteNoReturns = ss_PasteNoReturns;
 | 
						|
			Settings.Default.PastePlainText = ss_PastePlainText;
 | 
						|
			Settings.Default.SyncEnhancedDocuments = ss_SyncEnhancedDocuments;
 | 
						|
			Settings.Default.SeparateWindows = ss_SeparateWindows;
 | 
						|
			Settings.Default.VisioPath = ss_VisioPath;
 | 
						|
		}
 | 
						|
 | 
						|
 | 
						|
		private void btnIntrFaceStngs_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			ClearAllCheckedButtons();
 | 
						|
			tcSysOpts.SelectedTab = tiIntrFaceStngs;
 | 
						|
			btnIntrFaceStngs.Checked = true;
 | 
						|
		}
 | 
						|
 | 
						|
		private void btnStartMsg_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			ClearAllCheckedButtons();
 | 
						|
			tcSysOpts.SelectedTab = tiStUpMsg;
 | 
						|
			btnStartMsg.Checked = true;
 | 
						|
		}
 | 
						|
 | 
						|
		private void btnGeneral_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			ClearAllCheckedButtons();
 | 
						|
			tcSysOpts.SelectedTab = tiGeneral;
 | 
						|
			btnGeneral.Checked = true;
 | 
						|
		}
 | 
						|
 | 
						|
		private void ClearAllCheckedButtons()
 | 
						|
		{
 | 
						|
			btnGeneral.Checked = false;
 | 
						|
			btnStartMsg.Checked = false;
 | 
						|
			btnIntrFaceStngs.Checked = false;
 | 
						|
		}
 | 
						|
 | 
						|
		private void btnReset_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			Settings.Default.Reset();// .Reload();
 | 
						|
			CurrentSettings();
 | 
						|
			// show the resetted color scheme
 | 
						|
			RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable((eOffice2007ColorScheme)Settings.Default.SystemColor);
 | 
						|
		}
 | 
						|
 | 
						|
		private void colorPickerButton1_SelectedColorChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			if (!_initializing)
 | 
						|
			{
 | 
						|
				Settings.Default.TransitionRangeColor = colorPickerButton1.SelectedColor;
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		private void cbAnnotationPopup_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			Settings.Default.AutoPopUpAnnotations = cbAnnotationPopup.Checked;
 | 
						|
		}
 | 
						|
 | 
						|
		private void frmSysOptions_Load(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			ClearAllCheckedButtons();
 | 
						|
			tcSysOpts.SelectedTab = tiIntrFaceStngs;
 | 
						|
			btnIntrFaceStngs.Checked = true;
 | 
						|
      gpSeparateWindows.Enabled = CanChangeSeparateWindowsSetting; //Separate Windows only if one or less procedure sets open
 | 
						|
    }
 | 
						|
		private void cbStepTypeToolTip_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			Settings.Default.StepTypeToolTip = cbStepTypeToolTip.Checked;
 | 
						|
			VlnSettings.StepTypeToolTip = cbStepTypeToolTip.Checked;
 | 
						|
		}
 | 
						|
		private void cbTVExpand_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			Settings.Default.SaveTreeviewExpanded = cbTVExpand.Checked;
 | 
						|
		}
 | 
						|
		private void cbSeparateWindows_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			Settings.Default.SeparateWindows = cbSeparateWindows.Checked;
 | 
						|
		}
 | 
						|
		private void txbxVisioPath_Leave(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			Settings.Default.VisioPath = txbxVisioPath.Text;
 | 
						|
		}
 | 
						|
 | 
						|
		private void btnCancel_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			RestoreStartingSettings();
 | 
						|
		}
 | 
						|
 | 
						|
		private void txbxVisioPath_Leave_1(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			Settings.Default.VisioPath = txbxVisioPath.Text;
 | 
						|
		}
 | 
						|
 | 
						|
 | 
						|
		private void cbOTRemember_CheckedChanged(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			cbOTAutoOpen.Enabled = cbOTAutoOpen.Visible = cbShwRplWrdsColor.Checked;
 | 
						|
		}
 | 
						|
		private void cbShwRplWrdsColor_CheckedChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
			Settings.Default.cbShwRplWrdsColor = cbShwRplWrdsColor.Checked;
 | 
						|
			VlnSettings.cbShwRplWrdsColor = cbShwRplWrdsColor.Checked;
 | 
						|
			Properties.Settings.Default.cbShwRplWrdsColor = cbShwRplWrdsColor.Checked; // update setting value
 | 
						|
			Properties.Settings.Default.Save(); // save settings
 | 
						|
		}
 | 
						|
 | 
						|
		private void cbShwAnnoFilter_Click(object sender, EventArgs e)
 | 
						|
		{
 | 
						|
			frmVEPROMS.tv_SelectAnnotations();
 | 
						|
		}
 | 
						|
 | 
						|
	}
 | 
						|
} |