Exemplo n.º 1
0
        /// <summary>
        /// Updates 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>
        private void Update(
            EnvVarSetting setting = null,
            bool canEditName      = true,
            bool canEditValue     = true,
            bool canEditTarget    = true)
        {
            if (setting != null)
            {
                Setting = setting;
            }
            else
            {
                setting = Setting ?? EnvVarSetting.DefaultSetting;
            }

            EditModel               = setting;
            EditModel.CanEditName   = canEditName;
            EditModel.CanEditValue  = canEditValue;
            EditModel.CanEditTarget = canEditTarget;
            DataContext             = EditModel;
        }
        /// <summary>
        /// Updates 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>
        private void Update(
            EnvVarSetting setting = null,
            bool canEditName = true,
            bool canEditValue = true,
            bool canEditTarget = true)
        {
            if (setting != null)
            {
                Setting = setting;
            }
            else {
                setting = Setting ?? EnvVarSetting.DefaultSetting;
            }

            EditModel = setting;
            EditModel.CanEditName = canEditName;
            EditModel.CanEditValue = canEditValue;
            EditModel.CanEditTarget = canEditTarget;
            DataContext = EditModel;
        }
 /// <summary>
 /// Raises the <see cref="E:System.Windows.Window.Closing" /> event.
 /// </summary>
 /// <param name="e">A <see cref="T:System.ComponentModel.CancelEventArgs" /> that contains the event data.</param>
 protected override void OnClosing(CancelEventArgs e)
 {
     base.OnClosing(e);
     EditModel = DataContext as EditModel;
     Setting = EditModel;
 }