private void WriteUserSettings() { try { Sempra.Ops.IniFile iniFile = new Sempra.Ops.IniFile(FileNameUtils.GetUserIniFileName(settingsDir)); iniFile.WriteValue(FORM_NAME, "Top", this.Top); iniFile.WriteValue(FORM_NAME, "Left", this.Left); iniFile.WriteValue(FORM_NAME, "Width", this.Width); iniFile.WriteValue(FORM_NAME, "Height", this.Height); //iniFile.WriteValue(FORM_NAME, "DisplayComments", cedDisplayCmts.Checked); } catch (Exception error) { XtraMessageBox.Show("An error occurred while saving the user settings file." + Environment.NewLine + "Error CNF-237 in " + FORM_NAME + ".WriteUserSettings(): " + error.Message, FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ReadUserSettings() { try { //Now read user settings, ReadAppSettings() must be called first Sempra.Ops.IniFile iniFile = new Sempra.Ops.IniFile(FileNameUtils.GetUserIniFileName(settingsDir)); this.Top = iniFile.ReadValue(FORM_NAME, "Top", 120); this.Left = iniFile.ReadValue(FORM_NAME, "Left", 300); this.Width = iniFile.ReadValue(FORM_NAME, "Width", 1100); this.Height = iniFile.ReadValue(FORM_NAME, "Height", 1000); //cedDisplayCmts.Checked = iniFile.ReadValue(FORM_NAME, "DisplayComments", true); } catch (Exception error) { XtraMessageBox.Show("An error occurred while reading the user settings file." + Environment.NewLine + "Error CNF-236 in " + FORM_NAME + ".ReadUserSettings(): " + error.Message, FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void InitUserPrefDataLoad() { try { //Add Sempra Company data to prefs list. Sort the list by adding it into an arraylist first. //seCptyLkupTbl.PrimaryKey = new DataColumn[] { seCptyLkupTbl.Columns["CptySn"] }; ArrayList list = new ArrayList(); foreach (DataRow row in seCptyLkupTbl.Rows) list.Add(row["CptySn"].ToString()); list.Sort(); for (int i = 0; i < list.Count; i++) userPrefsForm.cklbxSeCptySn.Items.Add(list[i]); CdtyGroupCodesDal cdtyGroupCodesDal = new CdtyGroupCodesDal(sqlConnectionStr); IList<GetCdtyGroupCodesDto> cdtyGroupCodesList; //if (isTestMode) // cdtyGroupCodesList = cdtyGroupCodesDal.GetAllStub(); //else cdtyGroupCodesList = cdtyGroupCodesDal.GetAll(); if (cdtyGroupCodesList != null) { list.Clear(); for (int i = 0; i < cdtyGroupCodesList.Count; i++) { list.Add(cdtyGroupCodesList[i].CdtyGroupCode); } } //cdtyLkupTbl.PrimaryKey = new DataColumn[] { cdtyLkupTbl.Columns["CdtyCode"] }; //list.Clear(); //foreach (DataRow row in cdtyLkupTbl.Rows) // list.Add(row["CdtyCode"].ToString()); list.Sort(); for (int i = 0; i < list.Count; i++) userPrefsForm.cklbxCdtyGrp.Items.Add(list[i]); string dataLoadSettings = Path.Combine(appSettingsDir, "DataLoad.ini"); Sempra.Ops.IniFile iniFileDataLoad = new Sempra.Ops.IniFile(dataLoadSettings); StringCollection loadList = new StringCollection(); loadList = iniFileDataLoad.ReadValue(LOAD_SEMPRA_COMPANY); loadList = UpdatePrefCompanyList(loadList); // validating the company list with preference string chklistValue = ""; for (int i = 0; i < loadList.Count; i++) { chklistValue = loadList[i]; int index = userPrefsForm.cklbxSeCptySn.FindStringExact(chklistValue); userPrefsForm.cklbxSeCptySn.SetItemChecked(index, true); } loadList = iniFileDataLoad.ReadValue(LOAD_CDTY_GROUP); chklistValue = ""; for (int i = 0; i < loadList.Count; i++) { chklistValue = loadList[i]; int index = userPrefsForm.cklbxCdtyGrp.FindStringExact(chklistValue); userPrefsForm.cklbxCdtyGrp.SetItemChecked(index, true); } } catch (Exception except) { throw new Exception("An error occurred while loading iniital values for Our Company and Cdty Group." + Environment.NewLine + "Error CNF-009 in " + FORM_NAME + ".InitUserPrefDataLoad(): " + except.Message); } }
private void rfrmMain_Load(object sender, EventArgs e) { initSkinsMenu(); ReadAppSettings(); ReadUserSettings(); DevExpress.Skins.SkinManager.EnableFormSkins(); DevExpress.Skins.SkinManager.EnableMdiFormSkins(); string errorMessageText = String.Empty; try // get the user companies setup. { //Israel 12/4/14 - Static and local both necessary errorMessageText = "The error occurred while assigning internal access settings for the user: "******"BookingCoSn", typeof(string))); seCptyLkupTbl.PrimaryKey = new DataColumn[] { seCptyLkupTbl.Columns["BookingCoSn"] }; errorMessageText = "The error occurred while reading the companies using MSSql connection string: " + sqlConnectionStr; GetCompanies(); //if (seCptyLkupTbl.Rows.Count <= 0) //{ // XtraMessageBox.Show("rfrmMain_Load[1]: There are no trades for which this user has been granted access. Please contact Help Desk.", // "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); // Environment.ExitCode = -1; // System.Windows.Forms.Application.Exit(); //} } catch (Exception ex) { XtraMessageBox.Show("An error occurred while getting the company list from the database." + Environment.NewLine + errorMessageText + Environment.NewLine + "Error CNF-002 in " + FORM_NAME + ".rfrmMain_Load(): " + ex.Message, MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); //Environment.ExitCode = -1; //System.Windows.Forms.Application.Exit(); } try { Program.splashForm.ShowLoadProgress("Loading Initial Data..."); string msgFilter = ""; // GetMessageFilterString("W"); string inbFilter = ""; // GetInbMessageFilterString("W"); errorMessageText = "The error occurred while attempting to get the user permission data from the Web Service at: " + Properties.Settings.Default.ExtSvcAPIBaseUrl; ConfirmMgrAPIDal confirmMgrAPIDal = new ConfirmMgrAPIDal(Properties.Settings.Default.ExtSvcAPIBaseUrl, Properties.Settings.Default.ExtSvcAPIUserName, Properties.Settings.Default.ExtSvcAPIPassword); v_PermKeyList = confirmMgrAPIDal.GetPermissionKeys(p_UserId, out v_IsSuperUser); errorMessageText = "The error occurred while reading the user permission settings returned from the Web Service at: " + Properties.Settings.Default.ExtSvcAPIBaseUrl; //Israel 11/20/2015 -- Implement Permission key override from command line. if (v_IsPermKeyOverride) { v_IsSuperUser = false; v_PermKeyList = v_PermKeyOverrideList; } if (!v_IsSuperUser && v_PermKeyList.Count > 0) v_PermKeyDBInClauseStr = confirmMgrAPIDal.GetPermissionKeyDBInClause(v_PermKeyList); if (!v_IsSuperUser && v_PermKeyDBInClauseStr == "") { errorMessageText = String.Empty; XtraMessageBox.Show("No access rights have been granted for User: "******".", "Main Form Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); Environment.ExitCode = -2; System.Windows.Forms.Application.Exit(); } //Israel -- Testing stubs //v_IsSuperUser = false; //v_PermKeyList.Clear(); //v_PermKeyList.Add("1438"); //v_PermKeyDBInClauseStr = confirmMgrAPIDal.GetPermissionKeyDBInClause(v_PermKeyList); //Israel -- Testing stubs errorMessageText = "The error occurred while connecting to the update Message Server at: " + Properties.Settings.Default.MessageServer; dataManager = new DSManager(Properties.Settings.Default.MessageServer, // + HORNETQ_PROPS, Properties.Settings.Default.MessageUser, Properties.Settings.Default.MessagePassword, Properties.Settings.Default.UpdateFromCacheTimerIntervalSecs, msgFilter, inbFilter, v_PermKeyList, v_IsSuperUser); webServiceFilter = msgFilter; inbServiceFilter = inbFilter; dataManager.IncMessageCounter += new EventHandler(OnIncMessageCounter); dataManager.ResetMessageCounter += new EventHandler(OnResetMessageCounter); dataManager.BeginGridUpdates += new EventHandler(OnBeginGridUpdates); dataManager.EndGridUpdates += new EventHandler(OnEndGridUpdates); dataSet = new DataSet(); errorMessageText = "The error occurred while loading the current workflow and base data from the database."; LoadInitialData(); errorMessageText = "The error occurred while accessing the current workflow data just loaded from the database."; dataSet.Tables.Add(summaryDataTable); dataSet.Tables.Add(rqmtDataTable); dataSet.Tables.Add(confirmDataTable); } catch (Exception ex) { string innerException = ErrorMsgDump(ex); //SaveTextToFile(innerException, tempDir + "\\StartupException.log"); SaveTextToFile(innerException, Path.Combine(appTempDir, "StartupException.log")); XtraMessageBox.Show("An error occurred while loading trade and related data." + Environment.NewLine + errorMessageText + Environment.NewLine + "Error CNF-003 in " + FORM_NAME + ".rfrmMain_Load(): " + ex.Message, MAIN_FORM_STOP_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Stop); Environment.ExitCode = -2; System.Windows.Forms.Application.Exit(); } try { barStaticDBName.Caption = v_Server + @":" + v_Database; } catch (Exception ex) { string innerException = ErrorMsgDump(ex); SaveTextToFile(innerException, Path.Combine(appTempDir, "StartupException.log")); Environment.ExitCode = -3; System.Windows.Forms.Application.Exit(); } try { errorMessageText = "The error occurred while attempting to start the update message listeners."; dataManager.RegisterDataSet(ref dataSet); dataManager.RegisterGridControl(ref gridMain); dataManager.RegisterGridControl(ref gridRqmt); dataManager.RegisterGridControl(ref gridConfirm); Program.splashForm.ShowLoadProgress("Starting message listeners..."); dataManager.StartListening(); } catch (Exception except) { XtraMessageBox.Show("Failed to establish Update Message Server connection. " + Environment.NewLine + errorMessageText + Environment.NewLine + "Error CNF-004 in " + FORM_NAME + ".rfrmMain_Load(): " + except.Message, MAIN_FORM_STOP_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Stop); Environment.ExitCode = -2; System.Windows.Forms.Application.Exit(); } try { //Israel 14-11-10 -- Replace windows user id logon with the toolbar name. //windowsUserId = Sempra.Ops.Utils.GetUserName(); barStaticUserId.Caption = toolbarOrWindowsUserId.ToLower(); errorMessageText = "The error occurred while initializing the Summary data grid."; gridMain.DataSource = dataSet.Tables["SummaryData"]; gridMain.ForceInitialize(); errorMessageText = "The error occurred while initializing the Requirement data grid."; gridRqmt.DataSource = dataSet.Tables["RqmtData"]; gridRqmt.ForceInitialize(); errorMessageText = "The error occurred while initializing the Confirm data grid."; gridConfirm.DataSource = dataSet.Tables["TradeRqmtConfirm"]; gridConfirm.ForceInitialize(); errorMessageText = "The error occurred while initializing the Audit grid."; createAuditDataTable(); auditForm.gridAudit.DataSource = this.dataSet.Tables["AuditDataTable"]; auditForm.gridAudit.ForceInitialize(); auditForm.settingsDir = this.appSettingsDir; //Israel 9/21/2015 barBrowserStdBtns.Visible = false; barBrowserAddressBar.Visible = false; errorMessageText = "The error occurred while initializing the Xmit Result grid."; createXmitResultDataTable(); xmitResultStatusLogForm.gridXmitResult.DataSource = this.dataSet.Tables["XmitResultTable"]; xmitResultStatusLogForm.gridXmitResult.ForceInitialize(); xmitResultStatusLogForm.settingsDir = this.appSettingsDir; templateListForm.settingsDir = this.appSettingsDir; errorMessageText = "The error occurred while initializing the Trade Data Change grid."; createTradeDataChangeTable(); tradeDataChangesForm.gridTradeDataChanges.DataSource = this.dataSet.Tables["TradeDataChangeTable"]; tradeDataChangesForm.gridTradeDataChanges.ForceInitialize(); gridViewSummary.OptionsDetail.ShowDetailTabs = false; SetStdFiltersTableView(); //Setup user access rights errorMessageText = "The error occurred while setting up the user role code access rights."; userRoleView = new System.Data.DataTable(); userRoleView.Columns.Add(new DataColumn("RoleCode", typeof(string))); userRoleView.PrimaryKey = new DataColumn[] { userRoleView.Columns["RoleCode"] }; CallGetUserRoles(); SetUserAccess(); ApplyUserAccess(); if (!isHasAccess) { XtraMessageBox.Show("User: "******" has not been granted access.", "Main Form Stop Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); Environment.ExitCode = -4; System.Windows.Forms.Application.Exit(); } //Setup User filters errorMessageText = "The error occurred while setting up the internal user filter settings."; CreateUserFiltersView(); CallGetUserFilters(); luedUserFilter.Properties.DataSource = userFiltersView.DefaultView; luedUserFilter.Properties.DisplayMember = "Descr"; luedUserFilter.Properties.ValueMember = "Id"; errorMessageText = "The error occurred while reading the FilterSettings > MostRecentUserDefined value in the user settings file stored at: " + appSettingsDir + "."; //Can't be in ReadUserSettings because of table creation order. try { Sempra.Ops.IniFile iniFile = new Sempra.Ops.IniFile(FileNameUtils.GetUserIniFileName(appSettingsDir)); int filterIndex = iniFile.ReadValue("FilterSettings", "MostRecentUserDefined", NO_FILTER_VAL); if (filterIndex > NO_FILTER_VAL) { ApplyGridFilterByUserFilterIndex(filterIndex); luedUserFilter.EditValue = filterIndex; } } #pragma warning disable 0168 //Disable warning... catch (Exception excep) { } #pragma warning restore 0168 errorMessageText = "The error occurred while initializing the Add Requirements data entry form."; addRqmtForm.InitForm(); errorMessageText = "The error occurred while initializing the Edit Requirements data entry form."; editRqmtForm.rqmtStatusView = this.rqmtStatusView; editRqmtForm.settingsDir = this.appSettingsDir; editRqmtForm.InitForm(); editRqmtForm.SetSecurityAccess(isSecondCheckCreateCxl, isSubmitQueuedEFETTrades, isForceFinalApprove); for (int i = 0; i < frmEditRqmt.RQMT_ARRAY_MAX; i++) editRqmtForm.RqmtInitialStatus[i] = GetRqmtData(editRqmtForm.RQMT_CODES[i], "InitialStatus"); //InitUserPrefDataLoad(); errorMessageText = "The error occurred while initializing the internal list of Confirm Editor-controlled statuses."; noEditSempraRqmtStatus = new ArrayList(); noEditSempraRqmtStatus.Add("NEW"); noEditSempraRqmtStatus.Add("PREP"); noEditSempraRqmtStatus.Add("EXT_REVIEW"); noEditSempraRqmtStatus.Add("TRADER"); noEditSempraRqmtStatus.Add("MGR"); noEditSempraRqmtStatus.Add("OK_TO_SEND"); //webbrowserEcm.StatusTextChanged += new EventHandler(WebBrowser_StatusTextChanged); //webbrowserEcm.CanGoBackChanged += new EventHandler(WebBrowser_CanGoBackChanged); //webbrowserEcm.CanGoForwardChanged += new EventHandler(WebBrowser_CanGoForwardChanged); //webbrowserOcc.StatusTextChanged += new EventHandler(WebBrowser_StatusTextChanged); //webbrowserOcc.CanGoBackChanged += new EventHandler(WebBrowser_CanGoBackChanged); //webbrowserOcc.CanGoForwardChanged += new EventHandler(WebBrowser_CanGoForwardChanged); //webbrowserAtc.StatusTextChanged += new EventHandler(WebBrowser_StatusTextChanged); //webbrowserAtc.CanGoBackChanged += new EventHandler(WebBrowser_CanGoBackChanged); //webbrowserAtc.CanGoForwardChanged += new EventHandler(WebBrowser_CanGoForwardChanged); //webbrowserEpm.StatusTextChanged += new EventHandler(WebBrowser_StatusTextChanged); //webbrowserEpm.CanGoBackChanged += new EventHandler(WebBrowser_CanGoBackChanged); //webbrowserEpm.CanGoForwardChanged += new EventHandler(WebBrowser_CanGoForwardChanged); //Uri siteUri = new Uri(Properties.Settings.Default.EConfirmUrl); //webbrowserEConfirm.Url = siteUri; //webbrowserEConfirm.Navigate(Properties.Settings.Default.EConfirmUrl); //webbrowserEcm.Navigate(Properties.Settings.Default.EcmUrl); //barEditFA.Refresh(); //initComplete = true; } catch (Exception except) { XtraMessageBox.Show("An error occurred while applying security settings." + Environment.NewLine + errorMessageText + Environment.NewLine + "Error CNF-005 in " + FORM_NAME + ".rfrmMain_Load(): " + except.Message, MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); //Application.Exit(); } // init inbound panel try { InitInboundPanel(); } catch (Exception ex) { XtraMessageBox.Show("An error occurred while setting up the Inbound Documents panel." + Environment.NewLine + "Error CNF-006 in " + FORM_NAME + ".rfrmMain_Load(): " + ex.Message, MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } // INIT AXPNL try { InitAXPanel(); } catch (Exception ex) { XtraMessageBox.Show("An error occurred while setting up the Applicaton Extender panel." + Environment.NewLine + "Error CNF-007 in " + FORM_NAME + ".rfrmMain_Load(): " + ex.Message, MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } try { barEditFA.Refresh(); //Triggering ChangedFocusRow fires the event that filters associated docs if (gridViewSummary.RowCount > 1) { gridViewSummary.FocusedRowHandle = 1; gridViewSummary.FocusedRowHandle = 0; } initComplete = true; } catch (Exception except) { XtraMessageBox.Show("An error occurred while focusing the Main Grid to the first row." + Environment.NewLine + "Error CNF-008 in " + FORM_NAME + ".rfrmMain_Load(): " + except.Message, MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Program.splashForm.Close(); myTimer.Start(); //Israel 12/15/2008 - Red X } }
private void ReadUserDockSettings() { try { Sempra.Ops.IniFile iniFile = new Sempra.Ops.IniFile(FileNameUtils.GetUserIniFileName(appSettingsDir)); //barChkNB.Checked = iniFile.ReadValue("FilterSettings", "ShowNewBusiness", false); } catch (Exception error) { throw new Exception("An error occurred while reading user docking settings." + Environment.NewLine + "Error CNF-015 in " + FORM_NAME + ".ReadUserDockSettings(): " + error.Message); } }
private void WriteUserDockSettings() { try { Sempra.Ops.IniFile iniFile = new Sempra.Ops.IniFile(FileNameUtils.GetUserIniFileName(appSettingsDir)); } catch (Exception error) { throw new Exception("An error occurred while saving user docking settings." + Environment.NewLine + "Error CNF-014 in " + FORM_NAME + ".WriteUserDockSettings(): " + error.Message); } }
private void WriteUserSettings() { try { if (!System.IO.Directory.Exists(appSettingsDir)) System.IO.Directory.CreateDirectory(appSettingsDir); string dataLoadSettings = Path.Combine(appSettingsDir, "DataLoad.ini"); if (System.IO.File.Exists(dataLoadSettings)) System.IO.File.Delete(dataLoadSettings); //DevExpress.Utils.OptionsLayoutBase.FullLayout. gridViewSummary.SaveLayoutToXml(Path.Combine(appSettingsDir, SUMMARY_GRID_SETTINGS)); gridViewRqmt.SaveLayoutToXml(Path.Combine(appSettingsDir, RQMT_GRID_SETTINGS)); gridViewConfirm.SaveLayoutToXml(Path.Combine(appSettingsDir, CONFIRM_GRID_SETTINGS)); dockManager.SaveLayoutToXml(Path.Combine(appSettingsDir, DOCK_MGR_SETTINGS)); barmgrBrowser.SaveLayoutToXml(Path.Combine(appSettingsDir, BROWSER_BAR_SETTINGS)); inboundPnl1.SaveGridSettings(); Sempra.Ops.IniFile iniFile = new Sempra.Ops.IniFile(FileNameUtils.GetUserIniFileName(appSettingsDir)); Sempra.Ops.IniFile iniFileDataLoad = new Sempra.Ops.IniFile(dataLoadSettings); iniFile.WriteValue(FORM_NAME, "TradeDataPanel_Width", dpTradeData.Width); iniFile.WriteValue(FORM_NAME, "TradeDataPanel_Height", dpTradeData.Height); iniFile.WriteValue(FORM_NAME, "BrowserAppsPanel_Width", dpBrowserApps.Width); iniFile.WriteValue(FORM_NAME, "BrowserAppsPanel_Height", dpBrowserApps.Height); iniFile.WriteValue(FORM_NAME, "VaultedDocsPanel_Width", dpVaultDocViewer.Width); iniFile.WriteValue(FORM_NAME, "VaultedDocsPanel_Height", dpVaultDocViewer.Height); iniFile.WriteValue(FORM_NAME, "InboundQueuePanel_Width", dpInboundQueue.Width); iniFile.WriteValue(FORM_NAME, "InboundQueuePanel_Height", dpInboundQueue.Height); iniFile.WriteValue(FORM_NAME, "InboundViewerPanel_Width", dpInboundViewer.Width); iniFile.WriteValue(FORM_NAME, "InboundViewerPanel_Height", dpInboundViewer.Height); iniFile.WriteValue(FORM_NAME, "MainPanel_Height", panelContainerMain.Height); //5/19/09 Israel - Make sure if minimized when closed it doesn't write those settings here. if (this.WindowState != FormWindowState.Minimized) { iniFile.WriteValue(FORM_NAME, "Top", this.Top); iniFile.WriteValue(FORM_NAME, "Left", this.Left); iniFile.WriteValue(FORM_NAME, "Width", this.Width); iniFile.WriteValue(FORM_NAME, "Height", this.Height); } //iniFile.WriteValue(FORM_NAME, "SplitterInboundPosition", splitterInbound.SplitterPosition); iniFile.WriteValue(FORM_NAME, "TradeDataSplitter_Height", splitContainerTradeData.Height); iniFile.WriteValue(FORM_NAME, "TradeDataSplitter_Position", splitContainerTradeData.SplitterPosition); iniFile.WriteValue(FORM_NAME, "RqmtSplitter_Height", splitContainerRqmt.Height); iniFile.WriteValue(FORM_NAME, "RqmtSplitter_Position", splitContainerRqmt.SplitterPosition); //iniFile.WriteValue("Preferences", "SempraCompanyId", sempraCompanyId); iniFile.WriteValue("Preferences", "Skin", defaultLookAndFeel.LookAndFeel.SkinName.ToString()); iniFile.WriteValue("Preferences", "SaveToExcelDirectory", saveToExcelDirectory); iniFile.WriteValue("Preferences", "AutoDisplayDealsheet", userPrefsForm.cedAutoDispDealsheet.Checked); //iniFile.WriteValue("Preferences", "SaveToNewExcelFormat", userPrefsForm.cedSaveToNewExcelFormat.Checked); iniFile.WriteValue("FilterSettings", "ShowNewBusiness", barChkNB.Checked); iniFile.WriteValue("FilterSettings", "ReadyForFinalApproval", barChkRFA.Checked); iniFile.WriteValue("FilterSettings", "HasProblems", barChkHP.Checked); int faIndex = barEditFAComboBox.Items.IndexOf(barEditFA.EditValue); iniFile.WriteValue("FilterSettings", "FinalApproved", faIndex); iniFile.WriteValue("FilterSettings", "MostRecentUserDefined", GetMostRecentUserFilterIndex()); iniFile.WriteValue("PanelVisibility", "TradeData", barChkTradeData.Checked); //iniFile.WriteValue("PanelVisibility", "VaultedDocs", barChkVaultedDocs.Checked); iniFile.WriteValue("PanelVisibility", "InboundQueue", barChkInboundQueue.Checked); iniFile.WriteValue("PanelVisibility", "InboundViewer", barChkInboundViewer.Checked); iniFile.WriteValue("PanelVisibility", "BrowserApps", barChkBrowserApps.Checked); //iniFile.WriteValue("PanelVisibility", "VaultedDocsPanel", barChkVaultedDocsPanel.Checked); iniFile.WriteValue("PanelVisibility", "CustomFilterPanel", barChkCustomFilterPanel.Checked); iniFile.WriteValue("PanelVisibility", "GridFilterPanel", barChkGridFilterPanel.Checked); iniFile.WriteValue("PanelVisibility", "GroupFilterPanel", barChkGridGroupPanel.Checked); StringCollection list = new StringCollection(); for (int i = 0; i < userPrefsForm.cklbxSeCptySn.Items.Count; i++) { if (userPrefsForm.cklbxSeCptySn.Items[i].CheckState == CheckState.Checked) { list.Add(userPrefsForm.cklbxSeCptySn.Items[i].Value.ToString()); } } iniFileDataLoad.WriteValue(LOAD_SEMPRA_COMPANY, list); list.Clear(); for (int i = 0; i < userPrefsForm.cklbxCdtyGrp.Items.Count; i++) { if (userPrefsForm.cklbxCdtyGrp.Items[i].CheckState == CheckState.Checked) { list.Add(userPrefsForm.cklbxCdtyGrp.Items[i].Value.ToString()); } } iniFileDataLoad.WriteValue(LOAD_CDTY_GROUP, list); } catch (Exception error) { throw new Exception("An error occurred while saving user settings to: " + appSettingsDir + "." + Environment.NewLine + "Error CNF-013 in " + FORM_NAME + ".WriteUserSettings(): " + error.Message); } }
private void ReadUserSettings() { try { dockManager.ForceInitialize(); if (System.IO.File.Exists(Path.Combine(appSettingsDir, SUMMARY_GRID_SETTINGS))) gridViewSummary.RestoreLayoutFromXml(Path.Combine(appSettingsDir, SUMMARY_GRID_SETTINGS)); if (System.IO.File.Exists(Path.Combine(appSettingsDir, RQMT_GRID_SETTINGS))) gridViewRqmt.RestoreLayoutFromXml(Path.Combine(appSettingsDir, RQMT_GRID_SETTINGS)); if (System.IO.File.Exists(Path.Combine(appSettingsDir, CONFIRM_GRID_SETTINGS))) gridViewConfirm.RestoreLayoutFromXml(Path.Combine(appSettingsDir, CONFIRM_GRID_SETTINGS)); if (System.IO.File.Exists(Path.Combine(appSettingsDir, DOCK_MGR_SETTINGS))) dockManager.RestoreLayoutFromXml(Path.Combine(appSettingsDir, DOCK_MGR_SETTINGS)); if (System.IO.File.Exists(Path.Combine(appSettingsDir, BROWSER_BAR_SETTINGS))) barmgrBrowser.RestoreLayoutFromXml(Path.Combine(appSettingsDir, BROWSER_BAR_SETTINGS)); barBrowserStdBtns.Reset(); barBrowserAddressBar.Reset(); SetPanelMenuChecked(); //Now read user settings, ReadAppSettings() must be called first Sempra.Ops.IniFile iniFile = new Sempra.Ops.IniFile(FileNameUtils.GetUserIniFileName(appSettingsDir)); this.StartPosition = FormStartPosition.Manual; //Israel 1/14/2009 -- fixes -32000 problem. int top = iniFile.ReadValue(FORM_NAME, "Top", 100); int left = iniFile.ReadValue(FORM_NAME, "Left", 200); this.Top = top > 0 ? top : 1; this.Left = left > 0 ? left : 1; //this.Top = iniFile.ReadValue(FORM_NAME, "Top", 100); //this.Left = iniFile.ReadValue(FORM_NAME, "Left", 200); this.Width = iniFile.ReadValue(FORM_NAME, "Width", 1000); this.Height = iniFile.ReadValue(FORM_NAME, "Height", 700); //if (dpTradeData.Visibility == DockVisibility.Visible) //{ this.dpTradeData.Height = iniFile.ReadValue(FORM_NAME, "TradeDataPanel_Height", 1110); this.dpTradeData.Width = iniFile.ReadValue(FORM_NAME, "TradeDataPanel_Width", 990); //The SplitterPostion didn't restore exactly as saved until I set splitContainerTradeDat.Fixed = panel1. When it was set to None //it was enforcing proportional spacing and not doing what it was set to. //} //if (dpBrowserApps.Visibility == DockVisibility.Visible) // { // this.dpBrowserApps.Width = iniFile.ReadValue(FORM_NAME, "BrowserApps_PanelWidth", 561); /// } this.dpBrowserApps.Width = iniFile.ReadValue(FORM_NAME, "BrowserAppsPanel_Width", 568); this.dpBrowserApps.Height = iniFile.ReadValue(FORM_NAME, "BrowserAppsPanel_Height", 805); this.dpVaultDocViewer.Width = iniFile.ReadValue(FORM_NAME, "VaultedDocsPanel_Width", 1500); this.dpVaultDocViewer.Height = iniFile.ReadValue(FORM_NAME, "VaultedDocsPanel_Height", 175); this.dpInboundQueue.Width = iniFile.ReadValue(FORM_NAME, "InboundQueuePanel_Width", 990); this.dpInboundQueue.Height = iniFile.ReadValue(FORM_NAME, "InboundQueuePanel_Height", 260); this.dpInboundViewer.Width = iniFile.ReadValue(FORM_NAME, "InboundViewerPanel_Width", 990); this.dpInboundViewer.Height = iniFile.ReadValue(FORM_NAME, "InboundViewerPanel_Height", 1110); barChkTradeData.Checked = iniFile.ReadValue("PanelVisibility", "TradeData", true); barChkInboundQueue.Checked = iniFile.ReadValue("PanelVisibility", "InboundQueue", false); barChkInboundViewer.Checked = iniFile.ReadValue("PanelVisibility", "InboundViewer", false); barChkBrowserApps.Checked = iniFile.ReadValue("PanelVisibility", "BrowserApps", false); barChkVaultedDocsPanel.Checked = iniFile.ReadValue("PanelVisibility", "VaultedDocsPanel", false); if (barChkVaultedDocsPanel.Checked) this.dpVaultDocViewer.Width = iniFile.ReadValue(FORM_NAME, "VaultedDocsPanel_Width", 300); barChkCustomFilterPanel.Checked = iniFile.ReadValue("PanelVisibility", "CustomFilterPanel", true); barChkGridFilterPanel.Checked = iniFile.ReadValue("PanelVisibility", "GridFilterPanel", true); barChkGridGroupPanel.Checked = iniFile.ReadValue("PanelVisibility", "GridGroupPanel", true); string skin = iniFile.ReadValue("Preferences", "Skin", "Money Twins"); defaultLookAndFeel.LookAndFeel.SkinName = skin; saveToExcelDirectory = iniFile.ReadValue("Preferences", "SaveToExcelDirectory", appDocumentsDir); userPrefsForm.cedAutoDispDealsheet.Checked = iniFile.ReadValue("Preferences", "AutoDisplayDealsheet", false); isAutoDispDealsheet = userPrefsForm.cedAutoDispDealsheet.Checked; //isSaveToNewExcelFormat = userPrefsForm.cedSaveToNewExcelFormat.Checked; barChkNB.Checked = iniFile.ReadValue("FilterSettings", "ShowNewBusiness", false); barChkRFA.Checked = iniFile.ReadValue("FilterSettings", "ReadyForFinalApproval", false); barChkHP.Checked = iniFile.ReadValue("FilterSettings", "HasProblems", false); SetBarCheckImage(barChkNB); SetBarCheckImage(barChkRFA); SetBarCheckImage(barChkHP); finalApprovalFilterIndex = iniFile.ReadValue("FilterSettings", "FinalApproved", 0); //Israel 1/23/09 fixed -1 problem. if (finalApprovalFilterIndex < 0) finalApprovalFilterIndex = 0; string faVal = (string)barEditFAComboBox.Items[finalApprovalFilterIndex]; barEditFA.EditValue = faVal; barChkFAHints = new string[3]; barChkFAHints[0] = "Only Non-Final Approved Selected"; barChkFAHints[1] = "Only Final Approved Selected"; barChkFAHints[2] = "Non- and Final Approved Selected"; barEditFA.Hint = barChkFAHints[finalApprovalFilterIndex]; SetStdFilterHint(barChkNB); SetStdFilterHint(barChkHP); SetStdFilterHint(barChkRFA); this.panelContainerMain.Height = iniFile.ReadValue(FORM_NAME, "MainPanel_Height", 480); //splitContainerTradeData.Height = iniFile.ReadValue(FORM_NAME, "TradeDataSplitter_Height", 400); // //splitContainerRqmt.Height = iniFile.ReadValue(FORM_NAME, "RqmtSplitter_Height", 160); // splitContainerRqmt.SplitterPosition = iniFile.ReadValue(FORM_NAME, "RqmtSplitter_Position", 506); splitContainerTradeData.SplitterPosition = iniFile.ReadValue(FORM_NAME, "TradeDataSplitter_Position", 427); pnlCustomFilter.Visible = barChkCustomFilterPanel.Checked; gridViewSummary.OptionsView.ShowAutoFilterRow = barChkGridFilterPanel.Checked; gridViewSummary.OptionsView.ShowGroupPanel = barChkGridGroupPanel.Checked; } catch (Exception ex) { string innerException = ErrorMsgDump(ex); XtraMessageBox.Show(APP_NAME + " had a problem while reading the user''s saved settings." + Environment.NewLine + "Error CNF-012 in " + FORM_NAME + ".ReadUserSettings(): " + ex.Message, MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } }