private void RenameLocalFolder() { if (GridViewLocalFiles.SelectedRowsCount > 0) { string oldFolderName = GridViewLocalFiles.GetRowCellValue(GridViewLocalFiles.FocusedRowHandle, "Name").ToString(); string oldFolderPath = TextBoxLocalPath.Text + @"\" + oldFolderName; string newFolderName = StringExtensions.ReplaceInvalidChars(DialogExtensions.ShowTextInputDialog(this, "Rename Folder", "Folder Name:", oldFolderName)); string newFolderPath = TextBoxLocalPath.Text + @"\" + newFolderName; if (newFolderName != null && !newFolderName.Equals(oldFolderName)) { if (!Directory.Exists(newFolderPath)) { SetLocalStatus("A folder with this name already exists."); } else { SetLocalStatus($"Renaming folder to: {newFolderName}"); FileSystem.RenameDirectory(oldFolderPath, newFolderName); SetLocalStatus($"Successfully renamed folder to: {newFolderName}"); LoadLocalDirectory(DirectoryPathLocal); } } } }
/// <summary> /// Return the user's game region, either automatically by searching existing console directories or prompt /// the user to select one. /// </summary> /// <param name="owner">Parent form</param> /// <param name="gameId">Game Id</param> /// <returns></returns> public string GetGameRegion(Form owner, string gameId) { if (MainWindow.Settings.RememberGameRegions) { var gameRegion = MainWindow.Settings.GetGameRegion(gameId); if (!string.IsNullOrEmpty(gameRegion)) { return(gameRegion); } } if (MainWindow.Settings.AutoDetectGameRegion) { var foundRegions = Regions.Where(region => MainWindow.FtpConnection.DirectoryExists($"/dev_hdd0/game/{region}")).ToList(); foreach (var region in foundRegions.Where(region => DarkMessageBox.Show(MainWindow.Window, $"Game Region: {region} has been found for: {Title}\nIs this correct?", "Found Game Region", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)) { return(region); } _ = DarkMessageBox.Show(MainWindow.Window, "Could not find any regions on your console for this game title. You must install the game update for this title first.", "No Game Update", MessageBoxIcon.Error); return(null); } return(DialogExtensions.ShowListInputDialog(owner, "Game Regions", Regions.ToList())); }
public async Task RunAsyncShouldSetTelemetryClient() { var adapter = new Mock <BotAdapter>(); var dialog = new SimpleComponentDialog(); var conversationState = new ConversationState(new MemoryStorage()); // ChannelId and Conversation.Id are required for ConversationState and // ChannelId and From.Id are required for UserState. var activity = new Activity { ChannelId = "test-channel", Conversation = new ConversationAccount { Id = "test-conversation-id" }, From = new ChannelAccount { Id = "test-id" } }; var telemetryClientMock = new Mock <IBotTelemetryClient>(); using (var turnContext = new TurnContext(adapter.Object, activity)) { turnContext.TurnState.Add(telemetryClientMock.Object); await DialogExtensions.RunAsync(dialog, turnContext, conversationState.CreateProperty <DialogState>("DialogState"), CancellationToken.None); } Assert.Equal(telemetryClientMock.Object, dialog.TelemetryClient); }
private void ContextMenuLocalRenameFolder_Click(object sender, EventArgs e) { if (DgvLocalFiles.CurrentRow != null) { var oldFolderName = DgvLocalFiles.CurrentRow.Cells[2].Value.ToString(); var folderPath = TextBoxLocalPath.Text + @"\" + oldFolderName; var newFolderName = DialogExtensions.ShowTextInputDialog(this, "Rename Folder", "Folder Name: ", oldFolderName); var newFolderPath = TextBoxLocalPath.Text + @"\" + newFolderName; if (newFolderName != null && newFolderName.Equals(oldFolderName)) { if (!Directory.Exists(newFolderPath)) { SetLocalStatus($"A folder with this name already exists."); } else { SetConsoleStatus($"Renaming file {folderPath} to: {newFolderName}"); FileSystem.RenameDirectory(folderPath, newFolderName); SetConsoleStatus($"Successfully renamed folder to: {newFolderName}"); LoadLocalDirectory(LocalDirectoryPath); } } } }
private void ContextMenuItemConsoleRenameFolder_Click(object sender, EventArgs e) { try { var oldFolderName = DgvConsoleFiles.CurrentRow.Cells[2].Value.ToString(); var folderPath = TextBoxConsolePath.Text + oldFolderName; var newFolderName = DialogExtensions.ShowTextInputDialog(this, "Rename Folder", "Folder Name:", oldFolderName); var newFolderPath = TextBoxConsolePath.Text + newFolderName; if (newFolderName != null && !newFolderName.Equals(oldFolderName)) { if (FtpClient.DirectoryExists(folderPath)) { SetConsoleStatus($"A folder with this name already exists."); return; } else { SetConsoleStatus($"Renaming folder: {folderPath} to: {newFolderName}"); FtpExtensions.RenameFileOrFolder(FtpConnection, folderPath, newFolderName); SetConsoleStatus($"Successfully renamed folder to: {newFolderName}"); LoadConsoleDirectory(FtpDirectoryPath); } } } catch (Exception ex) { SetConsoleStatus($"Unable to rename folder. Error: {ex.Message}", ex); } }
private void MenuItemAddExistingProfile_ItemClick(object sender, ItemClickEventArgs e) { if (Directory.Exists(UserFolders.XboxProfiles)) { List <ListItem> profiles = new(); foreach (string profile in Directory.GetFiles(UserFolders.XboxProfiles, "*.*", SearchOption.AllDirectories)) { profiles.Add( new() { Name = Path.GetFileName(profile), Value = profile }); } if (profiles.Count > 0) { ListItem profile = DialogExtensions.ShowListViewDialog(this, "Load Profile", profiles); if (profile == null) { XtraMessageBox.Show(this, $"You don't have any profiles saved or none was selected.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { LoadProfile(profile.Value); } } else { XtraMessageBox.Show(this, $"You haven't saved any profiled.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void CreateLocalFolder() { try { var newName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder name: ", ""); if (newName != null) { string folderPath = TextBoxLocalPath.Text + @"\" + newName; if (Directory.Exists(folderPath)) { XtraMessageBox.Show($"A folder with this name already exists.", "Error"); return; } else { _ = Directory.CreateDirectory(folderPath); LoadLocalDirectory(LocalDirectoryPath); } } } catch (FtpException ex) { DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error"); } catch (Exception ex) { DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error"); } }
private void MenuItemAddProfileDetails_ItemClick(object sender, ItemClickEventArgs e) { try { string fileName = DialogExtensions.ShowOpenFileDialog(this, "Load Profile", ""); if (!fileName.IsNullOrEmpty()) { if (XtraMessageBox.Show(this, $"Would you like to save this profile?", "Save Profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string localProfilePath = Path.Combine(UserFolders.XboxProfiles, Path.GetFileName(fileName) + @"\"); string localProfileFilePath = Path.Combine(UserFolders.XboxProfiles, Path.GetFileName(fileName) + @"\" + Path.GetFileName(fileName)); Directory.CreateDirectory(localProfilePath); File.Copy(fileName, localProfileFilePath + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bak"); } LoadProfile(fileName); } } catch (Exception ex) { UpdateStatus($"Unable to load profile details.", ex); XtraMessageBox.Show(this, $"Unable to load profile details. Error Message: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void CreateConsoleFolder() { try { var folderName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder Name: ", ""); if (folderName != null) { string folderPath = FtpDirectoryPath + "/" + folderName; if (FtpClient.DirectoryExists(folderPath)) { XtraMessageBox.Show($"A folder with this name already exists.", "Error"); return; } else { _ = FtpExtensions.CreateDirectory(folderPath); LoadConsoleDirectory(FtpDirectoryPath); } } } catch (FtpException ex) { DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error"); } catch (Exception ex) { DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error"); } }
private void ButtonAddNewConsole_Click(object sender, EventArgs e) { foreach (object control in PanelConsoleProfiles.Controls) { if (control is ConsoleItem item) { item.ShouldHover = false; } } ConsoleProfile consoleProfile = DialogExtensions.ShowNewConnectionWindow(this, new ConsoleProfile(), false); if (consoleProfile != null) { Settings.ConsoleProfiles.Add(consoleProfile); LoadConsoles(); } else { foreach (object control in PanelConsoleProfiles.Controls) { if (control is ConsoleItem item) { item.ShouldHover = true; } } } }
public void CreateLocalFolder() { try { string newName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder name: ", ""); if (newName != null) { string folderPath = TextBoxLocalPath.Text + @"\" + newName; if (Directory.Exists(folderPath)) { XtraMessageBox.Show("A folder with this name already exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { SetLocalStatus($"Creating folder: {folderPath}"); Directory.CreateDirectory(folderPath); SetLocalStatus($"Successfully created folder: {folderPath}"); LoadLocalDirectory(DirectoryPathLocal); } } } catch (Exception ex) { SetLocalStatus($"Unable to create a new folder. Error: {ex.Message}"); XtraMessageBox.Show($"Unable to create a new folder. Error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MenuItemInstallFiles_ItemClick(object sender, ItemClickEventArgs e) { if (PackageItem != null) { DialogExtensions.ShowTransferPackagesDialog(this, TransferType.InstallPackage, PackageItem); } }
public static void ShowClipboardEmptyDialog() { var primary = Translations.GetString("Image cannot be pasted"); var secondary = Translations.GetString("The clipboard does not contain an image."); var markup = $"<span weight=\"bold\" size=\"larger\">{primary}</span>\n\n{secondary}\n"; DialogExtensions.ShowErrorDialog(markup); }
private void ImageFileLocation_Click(object sender, EventArgs e) { string fileLocation = DialogExtensions.ShowOpenFileDialog(this, "Choose File", "All Files|*.*"); if (!fileLocation.IsNullOrEmpty()) { TextBoxFileLocation.Text = fileLocation; } }
public void DockLast() { var window = DialogExtensions.GetAll <PlotWindow>().LastOrDefault(); if (window != null) { Dock(window.DataContext); } }
private void MenuItemExtract_ItemClick(object sender, ItemClickEventArgs e) { string fileName = DialogExtensions.ShowSaveFileDialog(this, "Extract Image", "*.png|PNG Image"); if (!fileName.IsNullOrEmpty()) { ImagePackage.Image.Save(fileName, ImageFormat.Png); } }
private void ToolStripLocalNewFolder_Click(object sender, EventArgs e) { var newName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder name: ", ""); if (newName != null) { _ = Directory.CreateDirectory(TextBoxLocalPath.Text + @"\" + newName); LoadLocalDirectory(LocalDirectoryPath); } }
private void ButtonEdit_Click(object sender, EventArgs e) { int selectedIndex = Settings.ConsoleProfiles.IndexOf(ConsoleProfile); ConsoleProfile oldConsoleProfile = Settings.ConsoleProfiles[selectedIndex]; ConsoleProfile newConsoleProfile = DialogExtensions.ShowNewConnectionWindow(this, oldConsoleProfile, true); oldConsoleProfile = newConsoleProfile; LoadConsoles(); }
private async Task OnReadyGoToNew() { if (Checked == true) { UserNew(); } else { await DialogExtensions.ShowDialog("ERROR", "Para continuar, Debes de aceptar los términos y Condiciones", "Aceptar"); } }
public static ResponseType ShowExpandCanvasDialog() { var primary = Translations.GetString("Image larger than canvas"); var secondary = Translations.GetString("The image being pasted is larger than the canvas size. What would you like to do?"); var markup = $"<span weight=\"bold\" size=\"larger\">{primary}</span>\n\n{secondary}"; return(DialogExtensions.ShowQuestionDialog(markup, new DialogButton(Translations.GetString("Expand canvas"), ResponseType.Accept, true), new DialogButton(Translations.GetString("Don't change canvas size"), ResponseType.Reject), new DialogButton(Stock.Cancel, ResponseType.Cancel))); }
private void ButtonAddNewConsole_Click(object sender, EventArgs e) { ConsoleProfile consoleProfile = DialogExtensions.ShowNewConnectionWindow(this, new ConsoleProfile(), false); if (consoleProfile != null) { Settings.ConsoleProfiles.Add(consoleProfile); MainWindow.Window.SaveSettings(); MainWindow.Window.LoadSettings(); LoadConsoles(); } }
PlotViewModel ConvertToViewModel(Object obj) { if (obj is PlotValue) { return(_contexts.FirstOrDefault(m => Object.ReferenceEquals(m.Plot, obj)) ?? DialogExtensions.GetAll <PlotWindow>(). Select(m => m.DataContext as PlotViewModel). Where(m => m != null). FirstOrDefault(m => Object.ReferenceEquals(m.Plot, obj))); } return(obj as PlotViewModel); }
private void ButtonEdit_Click(object sender, EventArgs e) { var selectedIndex = MainWindow.Settings.ConsoleProfiles.IndexOf(ConsoleProfile); var oldConsoleProfile = MainWindow.Settings.ConsoleProfiles[selectedIndex]; var newConsoleProfile = DialogExtensions.ShowNewConnectionWindow(this, oldConsoleProfile, true); if (newConsoleProfile != null) { oldConsoleProfile = newConsoleProfile; } LoadConsoles(); }
private void MenuItemInstallFiles_ItemClick(object sender, ItemClickEventArgs e) { InstalledModInfo installedModInfo = MainWindow.Settings.GetInstalledMods(ModItem.GetPlatform(), ModItem.CategoryId, ModItem.Id); bool isInstalled = installedModInfo != null; if (isInstalled) { DialogExtensions.ShowTransferModsDialog(this, TransferType.UninstallMods, ModItem.GetCategory(Categories), ModItem); } else { DialogExtensions.ShowTransferModsDialog(this, TransferType.InstallMods, ModItem.GetCategory(Categories), ModItem); } }
private void ToolItemEditBackup_Click(object sender, EventArgs e) { var backupFileIndex = DgvBackups.CurrentRow.Index; var backupFile = MainWindow.Settings.BackupFiles[backupFileIndex]; var newBackupFile = DialogExtensions.ShowBackupFileDetails(this, backupFile); if (newBackupFile != null) { MainWindow.Settings.UpdateBackupFile(backupFileIndex, newBackupFile); } LoadBackupFiles(); }
private void ButtonEdit_Click(object sender, EventArgs e) { int backupFileIndex = GridViewBackupFiles.FocusedRowHandle; BackupFile backupFile = MainWindow.BackupFiles.BackupFiles[backupFileIndex]; BackupFile newBackupFile = DialogExtensions.ShowBackupFileDetails(this, backupFile); if (newBackupFile != null) { MainWindow.BackupFiles.UpdateBackupFile(backupFileIndex, newBackupFile); } LoadBackupFiles(); }
public void Dock(Object obj) { var context = ConvertToViewModel(obj); if (context != null) { App.Current.Dispatcher.Invoke(() => { DialogExtensions.GetAll <PlotWindow>().Where(m => Object.ReferenceEquals(m.DataContext, context)).ForEach(window => { Display(context); window.Close(); }); }); } }
private async Task OnReadyGoToNext() { if (Index < Total) { Index = Index + 1; TipsImage = TipsLoad[Index - 1].Image; TipsType = TipsLoad[Index - 1].Type; TipsName = TipsLoad[Index - 1].Name; TipsDescription = TipsLoad[Index - 1].Description; } else { await DialogExtensions.ShowDialog("Fin de los tips", "Haz finalizado la lista de los tips disponibles!!!", "Aceptar"); await App.Navigation.PushAsync(new MainPage()); } }
private void ButtonCreateNewList_Click(object sender, EventArgs e) { string listName = DialogExtensions.ShowTextInputDialog(this, "Create New List", "List Name:", ""); if (!string.IsNullOrWhiteSpace(listName)) { if (CustomListNameExists(listName)) { XtraMessageBox.Show("A list with this name already exists.", "List Name Exists"); } else { Settings.AddCustomList(listName); LoadCustomLists(); } } }
private async Task OnReadyGoToNext() { if (Index < Total) { Index = Index + 1; ExerciseImage = ExerciseLoad[Index - 1].Image; ExerciseLevel = ExerciseLoad[Index - 1].Type; ExerciseName = ExerciseLoad[Index - 1].Exercise; ExerciseDescription = ExerciseLoad[Index - 1].Description; } else { await DialogExtensions.ShowDialog("Fin de los ejercicios", "Haz finalizado la lista de los ejercicios disponibles!!!", "Aceptar"); await App.Navigation.PushAsync(new MainPage()); } }