Exemplo n.º 1
0
        /// <summary>
        /// Called when the user wishes to change the prefered text editor.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Click_BrowseEditor(object sender, RoutedEventArgs e)
        {
            AppDialogBrowse dialog = new AppDialogBrowse(BrowseType.Files, new string[] { "*.exe", "Executables" });
            bool?           result = dialog.ShowDialog();

            if (result.HasValue && result.Value == true)
            {
                ctrlEditor.Text = dialog.SelectedPath;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when the user pressed the Browse button for the InstallPath variable.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Click_BrowseInstallPath(object sender, RoutedEventArgs e)
        {
            AppDialogBrowse dialog = new AppDialogBrowse(BrowseType.Directories, new string[] { "*.*", "All directories" });
            bool?           result = dialog.ShowDialog();

            if (result.HasValue && result.Value == true)
            {
                ctrlInstallPath.Text = dialog.SelectedPath;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Called when the user wishes to select a new executable file.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Click_BrowseExecutable(object sender, RoutedEventArgs e)
        {
            AppDialogBrowse dialog = new AppDialogBrowse(BrowseType.Files, new string[] { "*.exe", "Executables" });
            bool?           result = dialog.ShowDialog();

            if (result.HasValue && result.Value == true)
            {
                string path        = dialog.SelectedPath;
                string installPath = Preferences.InstallPath;

                int index = path.IndexOf(installPath);
                if (index != -1)
                {
                    int start  = installPath.Length + 1;
                    int length = (path.Length - installPath.Length - 1);
                    path = path.Substring(start, length);
                }

                ctrlExecutable.Text = path;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Common function for browsing related to the custom buttons.
        /// </summary>
        /// <param name="cText">The TextBox object with the control text.</param>
        /// <param name="cValue">The TextBox object with the action text.</param>
        private void Common_BrowseCustom(ref TextBox cText, ref TextBox cValue)
        {
            AppDialogBrowse dialog = new AppDialogBrowse(BrowseType.All, new string[] { "*.*", "All files" });
            bool?           result = dialog.ShowDialog();

            if (result.HasValue && result.Value == true)
            {
                string path = dialog.SelectedPath;

                // Do a check to see if it can be set directly...
                if (string.IsNullOrWhiteSpace(cText.Text))
                {
                    string[] tokens = path.Split('\\', '/');
                    if (tokens.Length > 0)
                    {
                        cText.Text = tokens[tokens.Length - 1];
                    }
                }

                cValue.Text = path;
            }
        }