/// <summary> /// event-worker for BasedataEventRecieved-event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void BasedataEventRecieved(object sender, FileScanner.EDJournalScanner.BasedataEventArgs e) { try { switch (e.EventType) { case FileScanner.EDJournalScanner.JournalEvent.Basedata: Program.Data.checkPotentiallyNewSystemOrStation(e.System, e.Station, e.Coordinates); System = e.System; Station = e.Station; if (e.Coordinates.Valid) { this.Coordinates = e.Coordinates; } break; } } catch (Exception ex) { CErr.processError(ex, "Error while processing the JournalEventRecieved-event"); } }
private void cmdCorrectSpelling_Click(object sender, EventArgs e) { String InfoString; try { InfoString = "Do you want to assign the misspelled commodity\n\n"; InfoString += String.Format("\t'{0}' (id={1})\n\n", dgvDataOwn.SelectedRows[0].Cells[2].Value, dgvDataOwn.SelectedRows[0].Cells[0].Value); InfoString += "to the well-known commodity\n\n"; InfoString += String.Format("\t'{0}' (id={1})", dgvData.SelectedRows[0].Cells[2].Value, dgvData.SelectedRows[0].Cells[0].Value); if (MessageBox.Show(InfoString, "Transfer data to new id...", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.OK) { m_MisspelledIDs.Add((Int32)dgvDataOwn.SelectedRows[0].Cells[0].Value, (Int32)dgvData.SelectedRows[0].Cells[0].Value); var deleteOwn = m_DGVTables[dgvDataOwn].Select(string.Format("id1 = {0}", dgvDataOwn.SelectedRows[0].Cells[0].Value)); foreach (var item in deleteOwn) { m_DGVTables[dgvDataOwn].Rows.Remove(item); } } CheckSaveButton(); } catch (Exception ex) { CErr.processError(ex, "Error in cmdConfirm_Click"); } }
private void dgvData_DragDrop(object sender, DragEventArgs e) { try { DataGridViewRow row = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow; Point clientPoint = dgvData.PointToClient(new Point(e.X, e.Y)); var rowIndexOfItemUnderMouseToDrop = dgvData.HitTest(clientPoint.X, clientPoint.Y).RowIndex; if ((row != null) || (rowIndexOfItemUnderMouseToDrop != -1)) { //DataGridViewRow newrow = row.Clone() as DataGridViewRow; //for (int i = 0; i < newrow.Cells.Count; i++) //{ // newrow.Cells .Value = row.Cells.Value; //} //dgvData.Rows.Add(newrow); } } catch (Exception ex) { CErr.processError(ex, "Error in dgvData_DragDrop"); } }
private void CommoditySelector_Load(object sender, EventArgs e) { DataColumn col; try { dgvCommodities.AutoGenerateColumns = false; m_Table = (SQL.Datasets.dsEliteDB.tbcommodityDataTable)Program.Data.BaseData.tbcommodity.Copy(); col = new DataColumn("is_Selected", typeof(Boolean)); col.DefaultValue = false; m_Table.Columns.Add(col); foreach (Int32 commodityID in m_selectedCommodities) { m_Table.FindByid(commodityID)["is_Selected"] = true; } m_BindingSource.DataSource = m_Table; dgvCommodities.DataSource = m_BindingSource; m_BindingSource.Sort = "loccommodity asc"; if (true || m_selectedCommodities.Count > 0) { cbOnlySelected.Checked = true; } } catch (Exception ex) { CErr.processError(ex, "Error in CommoditySelector_Load"); } }
private void GUIColorsView_Load(object sender, EventArgs e) { try { PrepareGUIObjects(); cbActivated.Checked = Program.Colors.UseColors; if (Program.Colors.UsePreset == 1) { rbPresetDefault.Checked = true; } else { rbPresetElite.Checked = true; } this.cbActivated.CheckedChanged += cbActivated_CheckedChanged; this.rbPresetElite.CheckedChanged += rbPreset_CheckedChanged; m_changedData = false; } catch (Exception ex) { CErr.processError(ex, "Error in GUIColorsView_Load"); } }
private void cmdChangeSQLPort_Click(object sender, EventArgs e) { try { UInt16 newPort; UInt16 oldPort; if (UInt16.TryParse(txtSQLConnectionPort.Text, out newPort)) { Boolean isOccupied = DBProcess.IsListenerOnPort(newPort) || DBProcess.IsConnectionOnPort(newPort); if (!isOccupied) { oldPort = Program.IniFile.GetValue <UInt16>("DB_Server", "Port", "3306"); if (MessageBox.Show(this, "Change db-port from " + oldPort + " to " + newPort + " ?", "Aborted", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) { // switch off the general log for the database STA.Settings.INIFile dbIniFile; if (Debugger.IsAttached) { dbIniFile = new STA.Settings.INIFile(Path.Combine(Program.IniFile.GetValue("DB_Server", "WorkingDirectory", @"..\..\..\RNDatabase\Database"), "Elite.ini"), false, true, true); } else { dbIniFile = new STA.Settings.INIFile(Program.GetDataPath(@"Database\Elite.ini"), false, true, true); } Program.IniFile.SetValue("DB_Server", "Port", newPort.ToString()); dbIniFile.SetValue("mysqld", "port", newPort.ToString()); MessageBox.Show(this, "Port changed, restart required.", "Changed configuration", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { txtSQLConnectionPort.Text = Program.IniFile.GetValue <UInt16>("DB_Server", "Port", "3306").ToString(); } } else { MessageBox.Show(this, "Selected port is already occupied", "Aborted", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtSQLConnectionPort.Text = Program.IniFile.GetValue <UInt16>("DB_Server", "Port", "3306").ToString(); } } else { MessageBox.Show(this, "Couldn't parse value as <UInt16>", "Aborted", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtSQLConnectionPort.Text = Program.IniFile.GetValue <UInt16>("DB_Server", "Port", "3306").ToString(); } } catch (Exception ex) { CErr.processError(ex, "Error while changing the tcp-port of the sql-server"); } }
/// <summary> /// the data object informs the gui about changed data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void m_DataSource_DataChanged(object sender, IBESettings.DataChangedEventArgs e) { try { } catch (Exception ex) { CErr.processError(ex, "Error in m_DataSource_DataChanged"); } }
/// <summary> /// exports the market data to a csv file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdExportCSV_Click(object sender, EventArgs e) { EliteDBIO.enLocalizationType activeSetting; String infoString; String parameterName; try { parameterName = gbType.Tag.ToString().Split(new char[] { ';' })[0]; activeSetting = m_DBCon.getIniValue <EliteDBIO.enLocalizationType>(DB_GROUPNAME, parameterName, EliteDBIO.enLocalizationType.Commodity.ToString(), false); switch (activeSetting) { case EliteDBIO.enLocalizationType.Commodity: infoString = "Export commodity localisation data"; break; case EliteDBIO.enLocalizationType.Category: infoString = "Export category localisation data"; break; case EliteDBIO.enLocalizationType.Economylevel: infoString = "Export economy localisation data"; break; default: throw new Exception("unknown setting : " + activeSetting); } SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*"; saveFileDialog1.DefaultExt = "csv"; saveFileDialog1.Title = infoString; saveFileDialog1.OverwritePrompt = true; saveFileDialog1.InitialDirectory = m_DBCon.getIniValue("General", "Path_Import", Program.GetDataPath("data"), false); DialogResult result = saveFileDialog1.ShowDialog(); if (result == DialogResult.OK) { Cursor = Cursors.WaitCursor; Program.Data.ExportLocalizationDataToCSV(saveFileDialog1.FileName, activeSetting); Cursor = Cursors.Default; } } catch (Exception ex) { Cursor = Cursors.Default; CErr.processError(ex, "Error while exporting to csv"); } }
/// <summary> /// selects another journal path /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdJournalPath_Click(object sender, EventArgs e) { try { SelectJournalPath(); } catch (Exception ex) { CErr.processError(ex, "Error in cmdJournalPath_Click"); } }
private void rbInterface_CheckedChanged(object sender, EventArgs e) { try { m_GUIInterface.saveSetting(sender); } catch (Exception ex) { CErr.processError(ex, "Error in rbOrderByStation_CheckedChanged"); } }
private void dgvDataOwn_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) { try { m_DeletedIDs.Add((Int32)e.Row.Cells["column_id2"].Value); } catch (Exception ex) { CErr.processError(ex, "Error in dgvDataOwn_UserDeletingRow"); } }
private void cmdClear_Click(object sender, EventArgs e) { try { txtSearchString.Text = ""; } catch (Exception ex) { CErr.processError(ex, "Error in dgvCommodities_CurrentCellDirtyStateChanged"); } }
void m_GUIInterface_DataSavedEvent(object sender, EventArgs e) { try { Program.PriceAnalysis.GUI.setFilterHasChanged(true); } catch (Exception ex) { CErr.processError(ex, "Error in m_GUIInterface_DataSavedEvent"); } }
private void LoadDisplaySettings(object sender, FileSystemEventArgs e) { try { LoadDisplaySettings(); } catch (Exception ex) { CErr.processError(ex, "Error while loading displaysettigns from event"); } }
private void AppData_Changed(object sender, FileSystemEventArgs e) { try { LoadAppConfig("App", true); } catch (Exception ex) { CErr.processError(ex, "Error in AppData_Changed()"); } }
private void cmdExit_Click(object sender, EventArgs e) { try { this.Close(); } catch (Exception ex) { CErr.processError(ex, "Error in cmdExit_Click"); } }
private void clbLanguageFilter_ItemCheck(object sender, ItemCheckEventArgs e) { try { m_DBCon.setIniValue(DB_GROUPNAME, clbLanguageFilter.Items[e.Index].ToString(), e.NewValue == CheckState.Checked ? true.ToString() : false.ToString()); this.BeginInvoke((MethodInvoker)(() => FilterData())); } catch (Exception ex) { CErr.processError(ex, "Error in clbLanguageFilter_ItemCheck"); } }
private void cmdMappings_Click(object sender, EventArgs e) { try { var mappingForm = new CommodityMappingsView(); mappingForm.ShowDialog(this); } catch (Exception ex) { CErr.processError(ex, "Error in cmdMappings_Click"); } }
private void LanguageEdit_Load(object sender, EventArgs e) { try { Program.Data.AddMissingLocalizationEntries(); m_DBCon = new DBConnector(Program.DBCon.ConfigData, true); Init(); } catch (Exception ex) { CErr.processError(ex, "Error while loading form"); } }
/// <summary> /// Combobox changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ComboBox_CheckedChanged(object sender, EventArgs e) { try { if (m_GUIInterface.saveSetting(sender)) { } } catch (Exception ex) { CErr.processError(ex, "Error in ComboBox_CheckedChanged"); } }
private void cmdClearAll_Click(object sender, EventArgs e) { try { foreach (SQL.Datasets.dsEliteDB.tbcommodityRow dRow in m_Table.Rows) { dRow["is_selected"] = false; } } catch (Exception ex) { CErr.processError(ex, "Error in cmdClearAll_Click"); } }
private void dgvCommodities_CurrentCellDirtyStateChanged(object sender, EventArgs e) { try { if (dgvCommodities.IsCurrentCellDirty) { dgvCommodities.CommitEdit(DataGridViewDataErrorContexts.Commit); } } catch (Exception ex) { CErr.processError(ex, "Error in dgvCommodities_CurrentCellDirtyStateChanged"); } }
private void dgvData_DragEnter(object sender, DragEventArgs e) { try { if (e.Data.GetDataPresent(typeof(DataGridViewRow))) { e.Effect = DragDropEffects.Link; } } catch (Exception ex) { CErr.processError(ex, "Error in dgvData_DragEnter"); } }
private void dgvDataOwn_MouseMove(object sender, MouseEventArgs e) { try { if (e.Button == MouseButtons.Left) { dgvDataOwn.DoDragDrop(this.dgvDataOwn.CurrentRow, DragDropEffects.Link); } } catch (Exception ex) { CErr.processError(ex, "Error in dgvDataOwn_MouseMove"); } }
private void cmdWarnLevels_Click(object sender, EventArgs e) { try { string Commodity = String.Empty; EDCommodityListView CView = new EDCommodityListView(); CView.ShowDialog(this); } catch (Exception ex) { CErr.processError(ex, "Error while showing warnlevels from settingstab"); } }
/// <summary> /// IBESettings_Load event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void IBESettings_Load(object sender, EventArgs e) { try { Init(); #if !useVNC gbVNCTest.Visible = false; #endif } catch (Exception ex) { CErr.processError(ex, "Error while loading settings"); } }
/// <summary> /// changes the data to selected "type" /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void rbType_CheckedChanged(object sender, EventArgs e) { try { if (m_GUIInterface.saveSetting(sender)) { LoadData(); FilterData(); } } catch (Exception ex) { CErr.processError(ex, "Error in rbType_CheckedChanged"); } }
/// <summary> /// event-worker for JournalEventRecieved-event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void JournalEventRecieved(object sender, FileScanner.EDJournalScanner.JournalEventArgs e) { try { switch (e.EventType) { case FileScanner.EDJournalScanner.JournalEvent.Fileheader: JournalHeaderObject = (JObject)e.Data; break; } } catch (Exception ex) { CErr.processError(ex, "Error while processing the JournalEventRecieved-event"); } }
private void dgvDataOwn_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e) { try { if (m_BindingSources != null) { m_BindingSources[((DataGridViewExt)sender)].EndEdit(); } cmdSave.Enabled = m_MainDataset.HasChanges(); } catch (Exception ex) { CErr.processError(ex, "Error in dgvDataOwn_RowsRemoved"); } }
private static void HandleException(Exception ex) { String FileName = String.Format("ed-ibe-dump-v{0}.dmp", VersionHelper.Parts(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version, 3).Replace(".", "_")); if (ex == null) { return; } SplashScreenForm.SetTopmost(false); CErr.processError(ex, "Unhandled Exception"); // ExceptionPolicy.HandleException(ex, "Default Policy"); //CreateMiniDump(FileName); //MessageBox.Show("Fatal error.\r\n\r\nA dump file (\"" + FileName + "\" has been created in your data directory. \r\n\r\nPlease place this in a file-sharing service such as SendSpace, Google Drive or Dropbox, then link to the file in the Frontier forums or on the GitHub archive or send e mail to [email protected]. This will allow the developers to fix this problem. \r\n\r\nThanks, and sorry about the crash..."); //Application.Exit(); }