Ejemplo n.º 1
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
            /// <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()));
            }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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);
                }
            }
        }
Ejemplo n.º 7
0
        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");
            }
        }
Ejemplo n.º 8
0
        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);
            }
        }
Ejemplo n.º 9
0
        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");
            }
        }
Ejemplo n.º 10
0
        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;
                    }
                }
            }
        }
Ejemplo n.º 11
0
        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);
            }
        }
Ejemplo n.º 12
0
 private void MenuItemInstallFiles_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (PackageItem != null)
     {
         DialogExtensions.ShowTransferPackagesDialog(this, TransferType.InstallPackage, PackageItem);
     }
 }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        private void ImageFileLocation_Click(object sender, EventArgs e)
        {
            string fileLocation = DialogExtensions.ShowOpenFileDialog(this, "Choose File", "All Files|*.*");

            if (!fileLocation.IsNullOrEmpty())
            {
                TextBoxFileLocation.Text = fileLocation;
            }
        }
Ejemplo n.º 15
0
        public void DockLast()
        {
            var window = DialogExtensions.GetAll <PlotWindow>().LastOrDefault();

            if (window != null)
            {
                Dock(window.DataContext);
            }
        }
Ejemplo n.º 16
0
        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);
            }
        }
Ejemplo n.º 17
0
        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);
            }
        }
Ejemplo n.º 18
0
        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();
        }
Ejemplo n.º 19
0
 private async Task OnReadyGoToNew()
 {
     if (Checked == true)
     {
         UserNew();
     }
     else
     {
         await DialogExtensions.ShowDialog("ERROR", "Para continuar, Debes de aceptar los términos y Condiciones", "Aceptar");
     }
 }
Ejemplo n.º 20
0
        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)));
        }
Ejemplo n.º 21
0
        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();
            }
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
        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();
        }
Ejemplo n.º 24
0
        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);
            }
        }
Ejemplo n.º 25
0
        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();
        }
Ejemplo n.º 26
0
        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();
        }
Ejemplo n.º 27
0
        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();
                    });
                });
            }
        }
Ejemplo n.º 28
0
        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());
            }
        }
Ejemplo n.º 29
0
        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();
                }
            }
        }
Ejemplo n.º 30
0
        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());
            }
        }