Beispiel #1
0
        /// <summary>
        /// Edits the on click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void EditOnClick(object sender, RoutedEventArgs e)
        {
            if (SelectedItem == null)
            {
                return;
            }
            var pair = EditWindow.Show(SelectedItem);

            if (pair.Value != MessageBoxResult.OK && pair.Value != MessageBoxResult.Yes)
            {
                return;
            }
            EnvVarActions.SetEnvVar(pair.Key);
            Update(OptionTarget);
        }
Beispiel #2
0
        /// <summary>
        /// Shows the specified setting.
        /// </summary>
        /// <param name="setting">The setting.</param>
        /// <param name="canEditName">if set to <c> true </c> [can edit name].</param>
        /// <param name="canEditValue">if set to <c> true </c> [can edit value].</param>
        /// <param name="canEditTarget">if set to <c> true </c> [can edit target].</param>
        /// <returns>EnvVarSetting.</returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public static KeyValuePair <EnvVarSetting, MessageBoxResult> Show(
            EnvVarSetting setting,
            bool canEditName   = true,
            bool canEditValue  = true,
            bool canEditTarget = true)
        {
            var w = new EditWindow();

            w.Update(setting, canEditName, canEditValue, canEditTarget);
            var dialog = w.ShowDialog();

            if (dialog == null)
            {
                throw new ArgumentNullException(nameof(dialog));
            }

            return(new KeyValuePair <EnvVarSetting, MessageBoxResult>(Setting, Result));
        }
Beispiel #3
0
        /// <summary>
        /// Adds the on click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void AddOnClick(object sender, RoutedEventArgs e)
        {
            var setting = SelectedItem;

            if (SelectedItem == null)
            {
                return;
            }
            setting.Name += UIText.Copy;
            var pair = EditWindow.Show(setting);

            if (pair.Value != MessageBoxResult.OK && pair.Value != MessageBoxResult.Yes)
            {
                return;
            }
            EnvVarActions.SetEnvVar(pair.Key);
            Update(OptionTarget);
        }
        /// <summary>
        /// Shows the specified setting.
        /// </summary>
        /// <param name="setting">The setting.</param>
        /// <param name="canEditName">if set to <c> true </c> [can edit name].</param>
        /// <param name="canEditValue">if set to <c> true </c> [can edit value].</param>
        /// <param name="canEditTarget">if set to <c> true </c> [can edit target].</param>
        /// <returns>EnvVarSetting.</returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public static KeyValuePair<EnvVarSetting, MessageBoxResult> Show(
            EnvVarSetting setting,
            bool canEditName = true,
            bool canEditValue = true,
            bool canEditTarget = true)
        {
            var w = new EditWindow();
            w.Update(setting, canEditName, canEditValue, canEditTarget);
            var dialog = w.ShowDialog();
            if (dialog == null) { throw new ArgumentNullException(nameof(dialog)); }

            return new KeyValuePair<EnvVarSetting, MessageBoxResult>(Setting, Result);
        }