private void deleteTrackToolStripButton_Click(object sender, EventArgs e) { // Click on 'delete button' if (customTracksListView.SelectedItems.Count == 1 && MessageBoxes.ShowQuestion(this, _QUESTION_DELETE_TRACK, MessageBoxButtons.YesNo) == DialogResult.Yes) { Cursor = Cursors.WaitCursor; try { ListViewItem selectedItem = customTracksListView.SelectedItems[0]; DFE selectedTrack = selectedItem.Tag as DFE; if (selectedTrack != null) { File.Delete(selectedTrack.FileName); // Refresh _RefreshCustomList(); StatusBarLogManager.ShowEvent(this, _STATUS_DELETE_OK); } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } finally { Cursor = Cursors.Default; } } }
/// <summary> /// Allows to change brake diameter /// </summary> /// <param name="isFrontBrakes"></param> private void _ChangeBrakesDiameter(bool isFrontBrakes) { string currentValue = (isFrontBrakes ? frontBrakesLabel.Text.Split('ø')[1] : rearBrakesLabel.Text.Split('ø')[1]); string message = (isFrontBrakes ? _MESSAGE_ENTER_FRONT_DIAMETER : _MESSAGE_ENTER_REAR_DIAMETER); PromptBox pBox = new PromptBox(_TITLE_BRAKES_DIAMETER, message, currentValue); DialogResult dr = pBox.ShowDialog(this); if (dr == DialogResult.OK && pBox.IsValueChanged) { Cursor = Cursors.WaitCursor; // Changing displacement string columnName = (isFrontBrakes ? SharedConstants.BRAKES_DIM_FRONT_PHYSICS_DB_COLUMN : SharedConstants.BRAKES_DIM_REAR_PHYSICS_DB_COLUMN); string newValue = pBox.ReturnValue; DatabaseHelper.UpdateCellFromTopicWherePrimaryKey(_PhysicsTable, columnName, _CurrentVehicle, newValue); // Reloading _InitializeDatasheetContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_BRAKE_DIAMETER_OK); Cursor = Cursors.Default; } }
private void customTracksListView_ItemCheck(object sender, ItemCheckEventArgs e) { // A track is being checked > perform control over replacing if (e.NewValue == CheckState.Checked) { // Does it replace any challenge ? ListViewItem item = customTracksListView.Items[e.Index]; string replaced = item.SubItems[3].Text; if (_ITEM_REPLACES_NONE.Equals(replaced)) { e.NewValue = CheckState.Unchecked; StatusBarLogManager.ShowEvent(this, _STATUS_ACTIVATE_KO_NO_REPLACEMENT); } else { // Does another track replace the same challenge ? foreach (ListViewItem anotherItem in customTracksListView.Items) { if (anotherItem != item && anotherItem.Checked) { string anotherReplaced = anotherItem.SubItems[3].Text; if (anotherReplaced.Equals(replaced)) { e.NewValue = CheckState.Unchecked; StatusBarLogManager.ShowEvent(this, _STATUS_ACTIVATE_KO_ALREADY_REPLACED); } } } } } }
private void tiresToolStripMenuItem_Click(object sender, EventArgs e) { // Click on 'Tires' menu item try { bool isModified = _ChangeTires(); if (isModified) { Cursor = Cursors.WaitCursor; // Reloading _InitializeDatasheetContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_TIRES_OK); Cursor = Cursors.Default; } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void setVehiclePerformanceButton_Click(object sender, EventArgs e) { // Click on 'Set' button (performance datasheet) try { Cursor = Cursors.WaitCursor; _ChangePerformanceData(); // Modification flag _IsDatabaseModified = true; // Reloading: not needed //_InitializeDatasheetContents(); StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_PERF_OK); } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } finally { Cursor = Cursors.Default; } }
private void verToolStripMenuItem_Click(object sender, EventArgs e) { // Click on 'Model' menu item try { bool isModified = _ChangeModelOrVersion(false); if (isModified) { Cursor = Cursors.WaitCursor; // Reloading _InitializeDatasheetContents(); // Vehicle names _UpdateSlotAndModName(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_RENAMING_OK); Cursor = Cursors.Default; } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void displacementToolStripMenuItem_Click(object sender, EventArgs e) { // Click on 'Displacement' menu item try { PromptBox pBox = new PromptBox("Engine displacement...", _MESSAGE_ENTER_DISPLACEMENT, engineDisplacementLabel.Text); DialogResult dr = pBox.ShowDialog(this); if (dr == DialogResult.OK && pBox.IsValueChanged) { Cursor = Cursors.WaitCursor; // Changing displacement string newValue = pBox.ReturnValue; DatabaseHelper.UpdateCellFromTopicWherePrimaryKey(_PhysicsTable, SharedConstants.DISPLACEMENT_PHYSICS_DB_COLUMN, _CurrentVehicle, newValue); // Reloading _InitializeDatasheetContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_DISPLACEMENT_OK); Cursor = Cursors.Default; } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void physicsEngineSetButton_Click(object sender, EventArgs e) { // Click on 'Set' button (engine location) try { Cursor = Cursors.WaitCursor; _ChangeEngineLocation(); _ChangeEngineOptions(); _ChangeSupercharger(); // Modification flag _IsDatabaseModified = true; // Reloading _InitializePhysicsContents(); StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_ENGINE_OK); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void physicsBodyworkSetButton_Click(object sender, EventArgs e) { // Click on Bodywork>Set button try { Cursor = Cursors.WaitCursor; _ChangeRideHeight(); _ChangeSuspension(); _ChangeBodyType(); _ChangeDimensions(); // Modification flag _IsDatabaseModified = true; // Reloading _InitializePhysicsContents(); StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_BODYWORK_OK); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void setVehicleTuningSpotButton_Click(object sender, EventArgs e) { // Click on 'Set' button if (_CurrentTuningBrand == null || string.IsNullOrEmpty(tuningSpotsComboBox.Text)) { return; } try { Cursor = Cursors.WaitCursor; _ChangeTuningSpot(); // Reloading _InitializeTunerContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_TUNING_SPOT_OK); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void fromTDUGenuineEditorToolStripMenuItem_Click(object sender, EventArgs e) { // Click on Import > from TDU Editor button try { Cursor = Cursors.WaitCursor; EditorTracksDialog dlg = new EditorTracksDialog(true); DialogResult dr = dlg.ShowDialog(this); if (dr == DialogResult.OK) { Couple <int> convertedCount = _ConvertIGEtoDFE(dlg.SelectedTracks); // Refresh custom tracks _RefreshCustomList(); string message = string.Format(_FORMAT_IMPORT_IGE_OK, convertedCount.FirstValue, convertedCount.SecondValue); StatusBarLogManager.ShowEvent(this, message); } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } finally { Cursor = Cursors.Default; } }
/// <summary> /// Starts renaming of specified packed file /// </summary> /// <param name="packedFilePath"></param> /// <param name="newFileName"></param> private bool _RenamePackedFile(string packedFilePath, string newFileName) { bool result = false; try { Cursor = Cursors.WaitCursor; _CurrentBnkFile.RenamePackedFile(packedFilePath, newFileName); SetBnkContentsChanged(); StatusBarLogManager.ShowEvent(this, _STATUS_RENAME_SUCCESS); result = true; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } finally { Cursor = Cursors.Default; } return(result); }
/// <summary> /// Constructeur paramétré. Le fichier spécifié est immédiatement chargé /// </summary> /// <param name="fileToEdit">Nom du fichier MAP à ouvrir</param> public MAPToolForm(string fileToEdit) { InitializeComponent(); entryCountLabel.Text = _ENTRY_COUNT_START_TEXT; // EVO 32 : support StatusLog StatusBarLogManager.AddNewLog(this, toolStripStatusLabel); // EVO 18 : clé par défaut inputKEYFilePath.Text = AppConstants.FOLDER_XML + AppConstants.FILE_MAP_KEY; if (fileToEdit != null) { // Fichier MAP paramétré inputFilePath.Text = fileToEdit; } else { // Fichier MAP par défaut... inputFilePath.Text = Program.ApplicationSettings.TduMainFolder + FileConstants.FOLDER_BNK + MAP.FILE_MAP; } // Ouverture refreshButton_Click(this, new EventArgs()); }
private void keepNameToolStripMenuItem_Click(object sender, EventArgs e) { // Clic sur le bouton de remplacement (mode "Keep Name") if (_GetSelectedFilePaths().Count != 0) { try { Collection <string> newFileNames; int modifiedCount = _ReplacePackedFiles(out newFileNames); if (modifiedCount >= 1) { Cursor = Cursors.WaitCursor; // BUG_18: rechargement SetBnkContentsChanged(); // EVO_32 : message de réussite string message = string.Format(_STATUS_REPLACE_SUCCESS_MANY, modifiedCount); StatusBarLogManager.ShowEvent(this, message); Cursor = Cursors.Default; } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } finally { Cursor = Cursors.Default; } } }
/// <summary> /// Defines window's contents /// </summary> private void _InitializeContents() { StatusBarLogManager.AddNewLog(this, toolStripStatusLabel); // Installer extModelBox.AllowDrop = intModelBox.AllowDrop = rimsFrontBox.AllowDrop = rimsRearBox.AllowDrop = gaugesLowBox.AllowDrop = gaugesHighBox.AllowDrop = soundBox.AllowDrop = true; // Camera-IK tab _InitializeCameraIKContents(); // Datasheet: brand logo string defaultImageName = _GetBrandLogoName(SharedConstants.DEFAULT_REF_BRANDS_DB_VAL); Image defaultImage = Image.FromFile(defaultImageName); brandPictureBox.InitialImage = brandPictureBox.ErrorImage = brandPictureBox.Image = defaultImage; // Lock vehicleEditTabControl.Enabled = false; }
private void tuneBrandNameChangeButton_Click(object sender, EventArgs e) { // Click on 'Change...' button if (string.IsNullOrEmpty(tuningBrandsComboBox.Text)) { return; } try { bool isModified = _ChangeTuningBrand(); if (isModified) { Cursor = Cursors.WaitCursor; // Reloading _InitializeTunerContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_TUNING_BRAND_OK); Cursor = Cursors.Default; } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
/// <summary> /// Constructeur par défaut /// </summary> public _2DBToDDSForm() { InitializeComponent(); // EVO 32 : StatusLog StatusBarLogManager.AddNewLog(this, toolStripStatusLabel); }
private void setVehicleLocationButton_Click(object sender, EventArgs e) { // Click on 'Set' button if (spotVehiclesListView.SelectedItems.Count == 1) { ListViewItem selectedItem = spotVehiclesListView.SelectedItems[0]; try { Cursor = Cursors.WaitCursor; _SetVehicleOnSlot(selectedItem); // Reloading _InitializeDealersContents(); _SelectSpotFromReference(_CurrentAvailabilitySpot); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_SETTING_VEHICLE_ON_DEALER_OK); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } } }
private void deleteToolStripButton_Click(object sender, EventArgs e) { // Click on 'Delete' button if (_LeDB == null || entryList.SelectedItems.Count != 1 || entryList.SelectedIndices[0] == entryList.Items.Count - 1) { return; } try { Cursor = Cursors.WaitCursor; // Getting current identifier and corresponding entry string id = entryList.SelectedItems[0].SubItems[1].Text; DBResource.Entry currentEntry = _LeDB.GetEntryFromId(id); // Removing item _LeDB.DeleteEntry(currentEntry); _LeDB.Save(); // List update _UpdateEntryList(true); StatusBarLogManager.ShowEvent(this, _STATUS_DEL_SUCCESS); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void modifyButton_Click(object sender, EventArgs e) { if (entryList.SelectedItems.Count == 0) { return; } // On récupère l'entrée sélectionnée try { UInt32 id = UInt32.Parse(entryList.SelectedItems[0].SubItems[1].Text); MAP.Entry entryToModify = leMAP.EntryList[id]; // Affichage de la fenêtre de modification DialogResult dr = new SizeModifierForm(entryToModify, leMAP).ShowDialog(this); // Des modifications ? if (dr != DialogResult.Cancel) { // EVO 30 : mise à jour de la ligne uniquement _UpdateSingleEntry(entryList.SelectedItems[0], id); Cursor = Cursors.Default; // EVO 32 StatusBarLogManager.ShowEvent(this, _STATUS_CHANGE_SUCCESS); } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void resetCameraIKButton_Click(object sender, EventArgs e) { // Click on 'Reset All' button try { Cursor = Cursors.WaitCursor; // If custom camera is used, it is unchecked if (useOwnCamCheckBox.Checked) { useOwnCamCheckBox.Checked = false; } // Action _ResetCamIK(_CurrentVehicle, _PhysicsTable); // Refresh _RefreshCameraIKContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_RESETTING_CAMIK_OK); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } }
private void ikToolStripMenuItem_Click(object sender, EventArgs e) { // Click on 'Apply>IK' if (!string.IsNullOrEmpty(availableCamIKComboBox.Text)) { try { Cursor = Cursors.WaitCursor; // Action _SetCamOrIK(_CurrentVehicle, availableCamIKComboBox.Text, _PhysicsTable, false); // Refresh _RefreshCameraIKContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_SETTING_IK_OK); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } } }
private void easySetButton_Click(object sender, EventArgs e) { // Click on 'Set' button (easy way) if (!string.IsNullOrEmpty(easyVehicleComboBox.Text)) { try { Cursor = Cursors.WaitCursor; // Action _SetEasyCamIK(_CurrentVehicle, easyVehicleComboBox.Text, _PhysicsTable); // Refresh _RefreshCameraIKContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_SETTING_EASY_CAMIK_OK); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } } }
private void analyzeButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tduPath.Text) || leMAP == null) { return; } try { Cursor = Cursors.WaitCursor; StatusBarLogManager.ShowEvent(this, _STATUS_ANALYSING); // Lance l'analyse Dictionary <string, long> currentFileList = MAP.ReportTDUFiles(tduPath.Text); // Tente l'association StringCollection failedFiles = new StringCollection(); idList = leMAP.LinkEntriesToFiles(currentFileList, laCle, failedFiles); // Met à jour la liste de fichiers _UpdateFileList(); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } finally { // EVO 32 StatusBarLogManager.ShowEvent(this, _STATUS_END_ANALYSIS); } }
private void exportOKResultsButton_Click(object sender, EventArgs e) { if (fileList.Items.Count == 0) { MessageBoxes.ShowInfo(this, _INFO_ANALYSIS_FIRST); return; } // Permet de sélectionner un fichier de sortie saveFileDialog.FileName = ""; saveFileDialog.Filter = GuiConstants.FILTER_XML_ALL_FILES; DialogResult dr = saveFileDialog.ShowDialog(this); if (dr == DialogResult.OK) { try { Cursor = Cursors.WaitCursor; _GenerateKEYFile(saveFileDialog.FileName, fileList.Items); Cursor = Cursors.Default; // EVO 32 StatusBarLogManager.ShowEvent(this, _STATUS_SUCCESS_GENERATE); } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } } }
private void trackTimer_Tick(object sender, EventArgs e) { // Timer interval reached // For each selected custom track, locate replaced name in DFE folder foreach (ListViewItem anotherItem in customTracksListView.Items) { try { DFE currentTrack = anotherItem.Tag as DFE; if (currentTrack != null) { FileInfo customTrackInfo = new FileInfo(currentTrack.FileName); DFE replacedChallenge = _GetReplacedChallenge(customTrackInfo.Name); if (replacedChallenge != null) { FileInfo replacedChallengeInfo = new FileInfo(replacedChallenge.FileName); string tduDfeFileName = string.Concat(LibraryConstants.GetSpecialFolder(LibraryConstants.TduSpecialFolder.Data_DFE), replacedChallengeInfo.Name); FileInfo dfeTrackInfo = new FileInfo(tduDfeFileName); if (anotherItem.Checked) { // Checked > synchronization if (dfeTrackInfo.Exists && dfeTrackInfo.LastWriteTime != customTrackInfo.LastWriteTime) { File.Copy(currentTrack.FileName, tduDfeFileName, true); string message = string.Format(_FORMAT_TRACK_SYNC_OK, currentTrack.TrackName, replacedChallenge.TrackName); StatusBarLogManager.ShowEvent(this, message); SystemSounds.Exclamation.Play(); } } /*else * { * // Unchecked > restoration * // Disabled beacause of conflicts * if (dfeTrackInfo.Exists && dfeTrackInfo.LastWriteTime != replacedChallengeInfo.LastWriteTime) * { * File.Copy(replacedChallenge.FileName, tduDfeFileName, true); * * string message = string.Format(_FORMAT_TRACK_RESTORE_OK, replacedChallenge.TrackName); * * StatusBarLogManager.ShowEvent(this, message); * SystemSounds.Exclamation.Play(); * } * }*/ } } } catch (Exception ex) { Log.Error("A track synchronization issue has occured.", ex); } } }
/// <summary> /// Loads database and reference data /// </summary> private void _LoadDatabase() { Cursor = Cursors.WaitCursor; // colors ColorsHelper.InitReference(AppConstants.FOLDER_XML); StatusBarLogManager.ShowEvent(this, _STATUS_LOADING_DATABASE_SUCCESS); Cursor = Cursors.Default; }
private void DBEditorForm_FormClosed(object sender, FormClosedEventArgs e) { _SearchBoxInstance = null; // Nettoyage log StatusBarLogManager.RemoveLog(this); // Task cleaning EditHelper.Task currentTask = EditHelper.Instance.GetTask(_EditedFile); EditHelper.Instance.RemoveTask(currentTask); }
/// <summary> /// Constructeur par défaut /// </summary> public FileBrowserForm() { InitializeComponent(); // Instance _Instance = this; // EVO_32 StatusBarLogManager.AddNewLog(this, contentsStatusLabel); _InitializeContents(); }
private void useCustomCamCheckBox_CheckedChanged(object sender, EventArgs e) { // Click on 'Use own camera set' checkbox if (useOwnCamCheckBox.Checked) { // Vehicle now uses its own camera try { Cursor = Cursors.WaitCursor; // Action VehicleSlotsHelper.VehicleInfo vi = VehicleSlotsHelper.VehicleInformation[_CurrentVehicle]; VehicleSlotsHelper.ChangeCameraById(_CurrentVehicle, vi.newCamera, _PhysicsTable); // Refresh _RefreshCameraIKContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_SETTING_CUSTOM_CAM_OK); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } } else { // Restoring default camera Cursor = Cursors.WaitCursor; // Action VehicleSlotsHelper.VehicleInfo vi = VehicleSlotsHelper.VehicleInformation[_CurrentVehicle]; short defaultCamera = short.Parse(vi.defaultCamera); VehicleSlotsHelper.ChangeCameraById(_CurrentVehicle, defaultCamera.ToString(), _PhysicsTable); // Refresh _RefreshCameraIKContents(); // Modification flag _IsDatabaseModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_UNSETTING_CUSTOM_CAM_OK); Cursor = Cursors.Default; } }