/// <summary> /// initialization of the whole log /// </summary> public void Init() { Cursor oldCursor = Cursor; DataTable Data; try { Cursor = Cursors.WaitCursor; this.DataSource = new IBESettings(); Program.SplashScreen.InfoAppendLast("<OK>"); // loading languages to combobox Data = new DataTable(); Program.DBCon.Execute("select * from tbLanguage", Data); cmbLanguage.DataSource = Data; cmbLanguage.DisplayMember = "language"; cmbLanguage.ValueMember = "language"; //prepare visited filter Tuple <Int32, String> newEntry; newEntry = new Tuple <Int32, String>(0, "show all"); cmbVisitedFilter.Items.Add(newEntry); newEntry = new Tuple <Int32, String>(1, "only visited systems"); cmbVisitedFilter.Items.Add(newEntry); newEntry = new Tuple <Int32, String>(2, "only visited stations"); cmbVisitedFilter.Items.Add(newEntry); cmbVisitedFilter.DisplayMember = "Item2"; cmbVisitedFilter.ValueMember = "Item1"; // loading all settings m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(Program.DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); m_GUIInterface.DataSavedEvent += m_GUIInterface_DataSavedEvent; txtSQLConnectionPort.Text = Program.IniFile.GetValue <UInt16>("DB_Server", "Port", "3306").ToString(); Cursor = oldCursor; } catch (Exception ex) { Cursor = oldCursor; throw new Exception("Error during initialization the commanders log tab", ex); } }
private void EDDNView_Load(object sender, EventArgs e) { try { // loading all settings m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(Program.DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); LoadTrustedSenders(); m_Communicator.DataChangedEvent += m_Communicator_DataChangedEvent; tmrRefresh.Start(); } catch (Exception ex) { CErr.processError(ex, "Error in Load event"); } }
private void EDDNView_Load(object sender, EventArgs e) { try { // loading all settings m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(Program.DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); LoadTrustedSenders(); LoadEDDNRelays(); m_Communicator.DataChangedEvent += m_Communicator_DataChangedEvent; tmrRefresh.Start(); } catch (Exception ex) { CErr.processError(ex, "Error in Load event"); } }
public EDStarmapInterface(DBConnector dbConnection) { try { m_SendQueue = new Queue <EDSMTransmissionData>(100); m_LogFile = new SingleThreadLogger(ThreadLoggerType.EDSMInterface, null, true); m_CurrentVersion = Enums_and_Utility_Classes.VersionHelper.Parts(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version, 3); m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, dbConnection); m_SendTimer = new System.Timers.Timer(); m_SendTimer.AutoReset = false; m_SendTimer.Elapsed += i_TransmitQueuedData; m_SendTimer.Start(); } catch (Exception ex) { throw new Exception("Error while initialization", ex); } }
private void CompanioDataView_Load(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, Program.DBCon); m_GUIInterface.loadAllSettings(this); GetState(); Cursor = Cursors.Default; } catch (Exception ex) { Cursor = Cursors.Default; CErr.processError(ex, "Error in CompanioDataView_Load"); } }
/// <summary> /// initialization of the whole log /// </summary> public void Init() { Cursor oldCursor = Cursor; try { Cursor = Cursors.WaitCursor; // loading all settings m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(Program.DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); #if DEBUG // Debug spesific functionality bManualLoadImage.Visible = true; #endif Cursor = oldCursor; } catch (Exception ex) { Cursor = oldCursor; throw new Exception("Error during initialization the commanders log tab", ex); } }
public EDStarmapInterface(DBConnector dbConnection) { try { m_SendQueue = new Queue<EDSMTransmissionData>(100); m_LogFile = new SingleThreadLogger(ThreadLoggerType.EDSMInterface, null, true); m_CurrentVersion = Enums_and_Utility_Classes.VersionHelper.Parts(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version, 3); m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, dbConnection); m_SendTimer = new System.Timers.Timer(); m_SendTimer.AutoReset = false; m_SendTimer.Elapsed += i_TransmitQueuedData; m_SendTimer.Start(); } catch (Exception ex) { throw new Exception("Error while initialization", ex); } }
/// <summary> /// initialization of the whole log /// </summary> public void Init() { Cursor oldCursor = Cursor; try { Cursor = Cursors.WaitCursor; m_InitialTopOfGrid = dgvCommandersLog.Top; m_InitialTopOfEditGroupBox = gbCL_LogEdit.Top; m_CL_State = enCLAction.None; cbLogSystemName.SelectedIndexChanged += cbLogSystemName_SelectedIndexChanged; //preparing the combo boxes m_DataSource.prepareCmb_EventTypes(ref cbLogEventType); m_DataSource.prepareCmb_EventTypes(ref cbLogSystemName); m_DataSource.prepareCmb_EventTypes(ref cbLogStationName, cbLogSystemName); m_DataSource.prepareCmb_EventTypes(ref cbLogCargoName); m_DataSource.prepareCmb_EventTypes(ref cbLogCargoAction); dtpLogEventDate.CustomFormat = System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern + " " + System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.LongTimePattern; dtpLogEventDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom; setCLFieldsEditable(false); // preparing the datagridview dgvCommandersLog.VirtualMode = true; dgvCommandersLog.ReadOnly = true; dgvCommandersLog.AllowUserToAddRows = false; dgvCommandersLog.AllowUserToOrderColumns = false; dgvCommandersLog.RowCount = m_DataSource.InitRetriever(); ((DataGridViewAutoFilterMultiColumnHeaderCell)dgvCommandersLog.Columns["eventtype"].HeaderCell).Retriever = m_DataSource.Retriever; ((DataGridViewAutoFilterMultiColumnHeaderCell)dgvCommandersLog.Columns["eventtype"].HeaderCell).RetrieverSQLSelect = "select distinct E.eventtype"; ((DataGridViewAutoFilterFullColumnHeaderCell)dgvCommandersLog.Columns["systemname"].HeaderCell).Retriever = m_DataSource.Retriever; ((DataGridViewAutoFilterFullColumnHeaderCell)dgvCommandersLog.Columns["systemname"].HeaderCell).RetrieverSQLSelect = "select distinct E.systemname"; ((DataGridViewAutoFilterFullColumnHeaderCell)dgvCommandersLog.Columns["stationname"].HeaderCell).Retriever = m_DataSource.Retriever; ((DataGridViewAutoFilterFullColumnHeaderCell)dgvCommandersLog.Columns["stationname"].HeaderCell).RetrieverSQLSelect = "select distinct E.stationname"; dgvCommandersLog.RowEnter += dgvCommandersLog_RowEnter; dgvCommandersLog.RowPrePaint += dgvCommandersLog_RowPrePaint; dgvCommandersLog.Paint += dgvCommandersLog_Paint; m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(Program.DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); Cursor = oldCursor; } catch (Exception ex) { Cursor = oldCursor; throw new Exception("Error during initialization the commanders log tab", ex); } }
/// <summary> /// initialization of the whole log /// </summary> public void Init() { Cursor oldCursor = Cursor; DataTable Data; try { Cursor = Cursors.WaitCursor; // loading languages to combobox Data = new DataTable(); Program.DBCon.Execute("select * from tbLanguage", Data); cmbLanguage.DataSource = Data; cmbLanguage.DisplayMember = "language"; cmbLanguage.ValueMember = "language"; //prepare visited filter Tuple<Int32, String> newEntry; newEntry = new Tuple<Int32, String>(0,"show all"); cmbVisitedFilter.Items.Add(newEntry); newEntry = new Tuple<Int32, String>(1,"only visited systems"); cmbVisitedFilter.Items.Add(newEntry); newEntry = new Tuple<Int32, String>(2,"only visited stations"); cmbVisitedFilter.Items.Add(newEntry); cmbVisitedFilter.DisplayMember = "Item2"; cmbVisitedFilter.ValueMember = "Item1"; // loading all settings m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(Program.DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); Cursor = oldCursor; } catch (Exception ex) { Cursor = oldCursor; throw new Exception("Error during initialization the commanders log tab", ex); } }
/// <summary> /// initialization of the whole log /// </summary> public void Init() { Cursor oldCursor = Cursor; String ComboboxValues; DataTable Data; try { Cursor = Cursors.WaitCursor; // fill dictionary with "RefreshDone"-flags m_IsRefreshed = new Dictionary<string,bool>(); m_IsRefreshed.Add(BASE_DATA, false); foreach (TabPage SubTabPage in tabPriceSubTabs.TabPages) m_IsRefreshed.Add(SubTabPage.Name, false); // preparing datatables m_DGVTables = new Dictionary<string,DataTable>(); m_DGVTables.Add(dgvStation1.Name, new dsEliteDB.tmpa_s2s_stationdataDataTable()); m_DGVTables.Add(dgvStation2.Name, new dsEliteDB.tmpa_s2s_stationdataDataTable()); m_DGVTables.Add(dgvStationToStationRoutes.Name, new dsEliteDB.tmpa_s2s_besttripsDataTable()); m_DGVTables.Add(dgvByStation.Name, new dsEliteDB.tmpa_bystationDataTable()); m_DGVTables.Add(dgvByCommodity.Name, new dsEliteDB.tmpa_bycommodityDataTable()); m_DGVTables.Add(dgvAllCommodities.Name, new dsEliteDB.tmpa_allcommoditiesDataTable()); Data = new DataTable(); m_DGVTables.Add(cmbStation1.Name, Data); m_DGVTables.Add(cmbStation2.Name, Data); m_DGVTables.Add(cmbByStation.Name, Data); m_DGVTables.Add(cmbByCommodity.Name, new DataTable()); m_DGVTables.Add(cmbSystemBase.Name, new DataTable()); // preparing bindingsources m_BindingSources = new Dictionary<String, BindingSource>(); m_BindingSources.Add(dgvStation1.Name, new BindingSource()); m_BindingSources.Add(dgvStation2.Name, new BindingSource()); m_BindingSources.Add(dgvStationToStationRoutes.Name, new BindingSource()); m_BindingSources.Add(dgvByStation.Name, new BindingSource()); m_BindingSources.Add(dgvByCommodity.Name, new BindingSource()); m_BindingSources.Add(dgvAllCommodities.Name, new BindingSource()); m_BindingSources.Add(cmbStation1.Name, new BindingSource()); m_BindingSources.Add(cmbStation2.Name, new BindingSource()); m_BindingSources.Add(cmbByStation.Name, new BindingSource()); m_BindingSources.Add(cmbByCommodity.Name, new BindingSource()); m_BindingSources.Add(cmbSystemBase.Name, new BindingSource()); // connect datatables to bindingsources and bindsources to datagrids foreach(KeyValuePair<String, BindingSource> currentKVP in m_BindingSources) { // set the DataTable as datasource of the BindingSource currentKVP.Value.DataSource = m_DGVTables[currentKVP.Key]; // set the BindingSource as datasource of the gui object FieldInfo DGGV_FieldInfo = this.GetType().GetField(currentKVP.Key, BindingFlags.NonPublic | BindingFlags.Instance); var DGV_Object =DGGV_FieldInfo.GetValue(this); if(DGV_Object.GetType().Equals(typeof(DataGridViewExt))) { ((DataGridViewExt)DGV_Object).AutoGenerateColumns = false; ((DataGridViewExt)DGV_Object).DataSource = currentKVP.Value; } else if(DGV_Object.GetType().Equals(typeof(ComboBox))) ((ComboBox)DGV_Object).DataSource = currentKVP.Value; else Debug.Print("unknown"); } cmbStation1.SelectedIndex = -1; cmbStation2.SelectedIndex = -1; cmbByStation.SelectedIndex = -1; cmbByCommodity.SelectedIndex = -1; cmbSystemBase.SelectedIndex = -1; ComboboxValues = Program.DBCon.getIniValue(DB_GROUPNAME, "SystemLightYearCmbValues", "10;25;50;100;200;1000", false); cmbSystemLightYears.Items.Clear(); foreach (String Value in ComboboxValues.Split(';')) cmbSystemLightYears.Items.Add(Int32.Parse(Value)); ComboboxValues = Program.DBCon.getIniValue(DB_GROUPNAME, "StationToStarCmbValues", "50;100;500;1000;2000;5000", false); cmbStationLightSeconds.Items.Clear(); foreach (String Value in ComboboxValues.Split(';')) cmbStationLightSeconds.Items.Add(Int32.Parse(Value)); ComboboxValues = Program.DBCon.getIniValue(DB_GROUPNAME, "MaxTripDistances", "1;5;10;12;15;17;20;25;30;40;50;100;150", false); cmbMaxTripDistance.Items.Clear(); foreach (String Value in ComboboxValues.Split(';')) cmbMaxTripDistance.Items.Add(Int32.Parse(Value)); m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(Program.DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); loadCommoditiesForByCommodity(); loadSystemsForBaseSystem(); createNewBaseView(); SetComboBoxEventsActive(true); Cursor = oldCursor; } catch (Exception ex) { Cursor = oldCursor; throw new Exception("Error during initialization the commanders log tab", ex); } }
/// <summary> /// initialization of the whole log /// </summary> public void Init() { Cursor oldCursor = Cursor; String currentLanguage; try { m_ChangedIDs = new Dictionary <Int32, Int32>(); m_MisspelledIDs = new Dictionary <Int32, Int32>(); m_DeletedIDs = new List <Int32>(); currentLanguage = m_DBCon.getIniValue(IBE.IBESettingsView.DB_GROUPNAME, "Language"); clbLanguageFilter.Items.Clear(); foreach (SQL.Datasets.dsEliteDB.tblanguageRow langRow in Program.Data.BaseData.tblanguage.Rows) { clbLanguageFilter.Items.Add(langRow.language, langRow.language.Equals(currentLanguage) ? true : false); } clbLanguageFilter.ItemCheck += clbLanguageFilter_ItemCheck; Cursor = Cursors.WaitCursor; // preparing datatables m_DGVTables = new Dictionary <object, DataTable>(); m_DGVTables.Add(dgvData, new DataTable(dgvData.Name)); m_DGVTables.Add(dgvDataOwn, new DataTable(dgvDataOwn.Name)); m_MainDataset = new DataSet(); m_DataAdapter = new Dictionary <Object, MySqlDataAdapter>(); foreach (KeyValuePair <Object, DataTable> dtKVP in m_DGVTables) { m_MainDataset.Tables.Add(dtKVP.Value); m_DataAdapter.Add(dtKVP.Key, null); } // preparing bindingsources m_BindingSources = new Dictionary <object, BindingSource>(); m_BindingSources.Add(dgvData, new BindingSource()); m_BindingSources.Add(dgvDataOwn, new BindingSource()); // connect datatables to bindingsources and bindsources to datagrids foreach (KeyValuePair <object, BindingSource> currentKVP in m_BindingSources) { // set the DataTable as datasource of the BindingSource currentKVP.Value.DataSource = m_DGVTables[currentKVP.Key]; // set the BindingSource as datasource of the gui object var DGV_Object = currentKVP.Key; if (DGV_Object.GetType().Equals(typeof(DataGridViewExt))) { ((DataGridViewExt)DGV_Object).AutoGenerateColumns = false; ((DataGridViewExt)DGV_Object).DataSource = currentKVP.Value; } else if (DGV_Object.GetType().Equals(typeof(ComboBox))) { ((ComboBox)DGV_Object).DataSource = currentKVP.Value; } else { Debug.Print("unknown"); } } m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(m_DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); rbCommodities.CheckedChanged += rbType_CheckedChanged; rbCategories.CheckedChanged += rbType_CheckedChanged; rbEconomyLevels.CheckedChanged += rbType_CheckedChanged; LoadData(); FilterData(); m_BindingSources[dgvData].Sort = "name"; m_BindingSources[dgvDataOwn].Sort = "name"; Cursor = oldCursor; } catch (Exception ex) { Cursor = oldCursor; throw new Exception("Error during initialization the commanders log tab", ex); } }
/// <summary> /// initialization of the whole log /// </summary> public void Init() { Cursor oldCursor = Cursor; DataTable Data; try { Cursor = Cursors.WaitCursor; this.DataSource = new IBESettings(); Program.SplashScreen.InfoAppendLast("<OK>"); // loading languages to combobox Data = new DataTable(); Program.DBCon.Execute("select * from tbLanguage", Data); cmbLanguage.DataSource = Data; cmbLanguage.DisplayMember = "language"; cmbLanguage.ValueMember = "language"; //prepare visited filter Tuple<Int32, String> newEntry; newEntry = new Tuple<Int32, String>(0,"show all"); cmbVisitedFilter.Items.Add(newEntry); newEntry = new Tuple<Int32, String>(1,"only visited systems"); cmbVisitedFilter.Items.Add(newEntry); newEntry = new Tuple<Int32, String>(2,"only visited stations"); cmbVisitedFilter.Items.Add(newEntry); cmbVisitedFilter.DisplayMember = "Item2"; cmbVisitedFilter.ValueMember = "Item1"; // loading all settings m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(Program.DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); m_GUIInterface.DataSavedEvent += m_GUIInterface_DataSavedEvent; txtSQLConnectionPort.Text = Program.IniFile.GetValue<UInt16>("DB_Server", "Port", "3306").ToString(); Cursor = oldCursor; } catch (Exception ex) { Cursor = oldCursor; throw new Exception("Error during initialization the commanders log tab", ex); } }
/// <summary> /// initialization of the whole log /// </summary> public void Init() { Cursor oldCursor = Cursor; String currentLanguage; try { m_ChangedIDs = new Dictionary<Int32, Int32>(); m_MisspelledIDs = new Dictionary<Int32, Int32>(); m_DeletedIDs = new List<Int32>(); currentLanguage = m_DBCon.getIniValue(IBE.IBESettingsView.DB_GROUPNAME, "Language"); clbLanguageFilter.Items.Clear(); foreach (SQL.Datasets.dsEliteDB.tblanguageRow langRow in Program.Data.BaseData.tblanguage.Rows) { clbLanguageFilter.Items.Add(langRow.language, langRow.language.Equals(currentLanguage) ? true : false); } clbLanguageFilter.ItemCheck += clbLanguageFilter_ItemCheck; Cursor = Cursors.WaitCursor; // preparing datatables m_DGVTables = new Dictionary<object,DataTable>(); m_DGVTables.Add(dgvData, new DataTable(dgvData.Name)) ; m_DGVTables.Add(dgvDataOwn, new DataTable(dgvDataOwn.Name)); m_MainDataset = new DataSet(); m_DataAdapter = new Dictionary<Object, MySqlDataAdapter>(); foreach (KeyValuePair<Object, DataTable> dtKVP in m_DGVTables) { m_MainDataset.Tables.Add(dtKVP.Value); m_DataAdapter.Add(dtKVP.Key, null); } // preparing bindingsources m_BindingSources = new Dictionary<object, BindingSource>(); m_BindingSources.Add(dgvData, new BindingSource()); m_BindingSources.Add(dgvDataOwn, new BindingSource()); // connect datatables to bindingsources and bindsources to datagrids foreach(KeyValuePair<object, BindingSource> currentKVP in m_BindingSources) { // set the DataTable as datasource of the BindingSource currentKVP.Value.DataSource = m_DGVTables[currentKVP.Key]; // set the BindingSource as datasource of the gui object var DGV_Object = currentKVP.Key; if(DGV_Object.GetType().Equals(typeof(DataGridViewExt))) { ((DataGridViewExt)DGV_Object).AutoGenerateColumns = false; ((DataGridViewExt)DGV_Object).DataSource = currentKVP.Value; } else if(DGV_Object.GetType().Equals(typeof(ComboBox))) ((ComboBox)DGV_Object).DataSource = currentKVP.Value; else Debug.Print("unknown"); } m_GUIInterface = new DBGuiInterface(DB_GROUPNAME, new DBConnector(m_DBCon.ConfigData, true)); m_GUIInterface.loadAllSettings(this); rbCommodities.CheckedChanged += rbType_CheckedChanged; rbCategories.CheckedChanged += rbType_CheckedChanged; rbEconomyLevels.CheckedChanged += rbType_CheckedChanged; LoadData(); FilterData(); m_BindingSources[dgvData].Sort = "name"; m_BindingSources[dgvDataOwn].Sort = "name"; Cursor = oldCursor; } catch (Exception ex) { Cursor = oldCursor; throw new Exception("Error during initialization the commanders log tab", ex); } }