void OnFilesViewSelectionChanged(object sender, RoutedEventArgs args) { if (startupFileListView.Items.Count == 0) { if (GetCurrentProgram() != null) { ToggleFilesOptions(true, true); ToggleFilesOptions(false, false); } else { ToggleFilesOptions(false, false); } return; } if (GetCurrentProgram().StartupFiles.Count > 0) { ToggleFilesOptions(true, true); } else { ToggleFilesOptions(false, false); } SStartupFile currentFile = GetCurrentProgram().GetFile((startupFileListView.SelectedItem as ListViewItem).Content as string); startupFileTextBox.Text = currentFile.FullName; copyFileCheckbox.IsChecked = (bool)currentFile.Copy; launchWithProgCheckbox.IsChecked = (bool)currentFile.LaunchWithProgram; }
void OnLaunchProgramCheckboxChecked(object sender, RoutedEventArgs args) { SStartupFile file = GetCurrentStartupFile(); if (file != null) { file.LaunchWithProgram = (bool)launchWithProgCheckbox.IsChecked; } }
void OnCopyFileCheckboxClicked(object sender, RoutedEventArgs args) { SStartupFile file = GetCurrentStartupFile(); if (file != null) { file.Copy = (bool)copyFileCheckbox.IsChecked; } }
void OnFileTextChanged(object sender, RoutedEventArgs args) { SStartupFile file = GetCurrentStartupFile(); if (file != null) { file.SetFilePath(startupFileTextBox.Text); } }
private bool ApplyCurrentSettings() { if (!ValidateDefs()) { CUserInteractionUtils.ShowErrorMessageBox(Properties.Resources.DCCDefChangesNotSaved); return(false); } if (GetCurrentProgram() != null) { if (File.Exists(programExeTextBox.Text)) { SDCCProgram pro = GetCurrentProgram(); pro.ExecutablePath = programExeTextBox.Text; } else { CUserInteractionUtils.ShowErrorMessageBox(Properties.Resources.CommonPathDoesntExist + " (" + programExeTextBox.Text + ")"); } if (GetCurrentStartupFile() != null) { if (File.Exists(startupFileTextBox.Text)) { SStartupFile file = GetCurrentStartupFile(); file.SetFilePath(startupFileTextBox.Text); file.Copy = (bool)copyFileCheckbox.IsChecked; file.LaunchWithProgram = (bool)launchWithProgCheckbox.IsChecked; } else { CUserInteractionUtils.ShowErrorMessageBox(Properties.Resources.CommonPathDoesntExist + " (" + startupFileTextBox.Text + ")"); } } UpdateListViews(); } ApplyAllChanges(); return(true); }
int AddFileEntryCallback(TextBox box, System.Windows.Forms.DialogResult res) { if (GetCurrentProgram() != null) { SDCCProgram prog = GetCurrentProgram(); if (prog.StartupFiles.ContainsKey(box.Text)) { CUserInteractionUtils.ShowErrorMessageBox(Properties.Resources.DCCDefDuplicateEntry + " " + box.Text); return(0); } SStartupFile newFile = new SStartupFile(box.Text, ""); prog.StartupFiles.Add(newFile.Name, newFile); RefreshFilesListView(); } return(0); }
void OnBrowseDirClicked(object sender, RoutedEventArgs e) { // TODO: Remimplement System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog(); // Error checking can be omitted since there are only valid entries to begin with ComboBoxItem item = (ComboBoxItem)dccProgramDropdown.SelectedItem; string progName = (string)item.Content; CDCCDefinition prog = CApplicationSettings.Instance.GetDCCProgram(progName); if (prog != null) { string filter = ""; int j = 0; foreach (string key in prog.Programs.Keys) { SDCCProgram program = prog.GetProgram(key); int i = 0; foreach (string fileKey in program.StartupFiles.Keys) { SStartupFile file = program.GetFile(fileKey); if (i == 0) { filter += program.Name + " Files|"; } filter += "*." + file.Extension; if (i < program.StartupFiles.Count - 1) { filter += ";"; } ++i; } // TODO: What if there are two progs but only one startup? if (j < prog.Programs.Count - 1) { filter += "|"; } ++j; } dialog.Filter = filter; } dialog.InitialDirectory = (string)CApplicationSettings.Instance.GetValue(ESettingsStrings.GameFolderPath).GetValueString(); System.Windows.Forms.DialogResult res = dialog.ShowDialog(); if (res == System.Windows.Forms.DialogResult.Cancel) { if (saveFileTextBox.Text != CApplicationSettings.Instance.GetValue(ESettingsStrings.RootPath).GetValueString()) { return; } string sRootPath = (string)CApplicationSettings.Instance.GetValue(ESettingsStrings.RootPath).GetValueString(); string sGameFolder = (string)CApplicationSettings.Instance.GetValue(ESettingsStrings.GameFolderPath).GetValueString(); sGameFolder = sGameFolder == null ? "" : sGameFolder; SetDesiredSavePath(sGameFolder + "\\Objects\\"); } else { SetDesiredSavePath(dialog.FileName); } }