Exemplo n.º 1
0
        /// <summary>
        /// Event called when the dialog is closing.</summary>
        /// <param name="args"></param>
        protected override void OnCloseDialog(CloseDialogEventArgs args)
        {
            if (args.DialogResult == true)
            {
                if (Action == SettingsAction.Save)
                {
                    if (m_saveDialog.ShowCommonDialogWorkaround() == true)
                    {
                        SaveSettings(m_saveDialog.FileName);
                    }
                    else
                    {
                        return;
                    }
                }
                else if (Action == SettingsAction.Load)
                {
                    if (m_openDialog.ShowCommonDialogWorkaround() == true)
                    {
                        if (!LoadSettings(m_openDialog.FileName))
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            RaiseCloseDialog(args);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Event called when the dialog is closing.</summary>
        /// <param name="args"></param>
        protected override void OnCloseDialog(CloseDialogEventArgs args)
        {
            if (args.DialogResult == true)
            {
                if (Action == SettingsAction.Save)
                {
                    if (m_saveDialog.ShowCommonDialogWorkaround() == true)
                    {
                        SaveSettings(m_saveDialog.FileName);
                    }
                    else
                    {
                        return;
                    }
                }
                else if (Action == SettingsAction.Load)
                {
                    if (m_openDialog.ShowCommonDialogWorkaround() == true)
                    {
                        if (!LoadSettings(m_openDialog.FileName))
                            return;
                    }
                    else
                    {
                        return;
                    }
                }
            }

            RaiseCloseDialog(args);
        }
 /// <summary>
 /// Sets the (boolean) Result before the dialog closes.</summary>
 /// <param name="args">Event args</param>
 protected override void OnCloseDialog(CloseDialogEventArgs args)
 {
     base.OnCloseDialog(args);
     if (Result != MessageBoxResult.No)
     {
         Result = args.DialogResult == true ? MessageBoxResult.Yes : MessageBoxResult.Cancel;
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Event fired when the dialog is closing</summary>
        /// <param name="args">Event args</param>
        protected override void OnCloseDialog(CloseDialogEventArgs args)
        {
            if (args.DialogResult != true)
            {
                m_settingsService.UserState = m_originalState;
            }

            RaiseCloseDialog(args);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Event fired when the dialog is closing</summary>
        /// <param name="args">Event args</param>
        protected override void OnCloseDialog(CloseDialogEventArgs args)
        {
            if (args.DialogResult != true)
            {
                m_settingsService.UserState = m_originalState;
            }

            RaiseCloseDialog(args);
        }
Exemplo n.º 6
0
        private void ViewModel_CloseDialog(object sender, CloseDialogEventArgs e)
        {
            if (!m_closing)
            {
                try
                {
                    m_closing = true;

                    // DAN: Workaround as for some reason even after dialog is closed
                    // The command manager keeps querying the commands in the data model!
                    DataContext = null;

                    // Only set dialog result if this is a modal dialog
                    if (ComponentDispatcher.IsThreadModal)
                    {
                        try
                        {
                            DialogResult = e.DialogResult;

                        }
                        catch (InvalidOperationException)
                        {
                            // Occasional strange behavior when trying to set DialogResult
                            // when the window does not think it is modal?
                        }
                    }

                    // Is this required?
                    Close();
                }
                finally
                {
                    m_closing = false;
                }
            }
        }
Exemplo n.º 7
0
 // This is called when the view model requests the close - e.g. if the vm CloseCommand has been executed
 private void ViewModel_CloseDialog(object sender, CloseDialogEventArgs e)
 {
     if (!m_closing)
     {
         try
         {
             m_closing = true;
             m_host.RequestClose(e.DialogResult);
         }
         finally
         {
             m_closing = false;
         }
     }
 }
Exemplo n.º 8
0
        protected override void OnCloseDialog(CloseDialogEventArgs args)
        {
            base.OnCloseDialog(args);
            if (args.DialogResult == true)
            {
                var uris = (from item in m_checkInItems
                            where item.IsChecked
                            select item.Resource.Uri);

                m_sourceControlService.CheckIn(uris, Description);
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// Raises the CloseDialog event and performs custom processing</summary>
 /// <param name="args">CloseDialogEventArgs containing event data</param>
 protected void RaiseCloseDialog(CloseDialogEventArgs args)
 {
     CloseDialog.Raise <CloseDialogEventArgs>(this, args);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Raises the CloseDialog event and performs custom processing</summary>
 /// <param name="args">CloseDialogEventArgs containing event data</param>
 protected virtual void OnCloseDialog(CloseDialogEventArgs args)
 {
     RaiseCloseDialog(args);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Raises the CloseDialog event and performs custom processing</summary>
 /// <param name="args">CloseDialogEventArgs containing event data</param>
 protected void RaiseCloseDialog(CloseDialogEventArgs args)
 {
     CloseDialog.Raise<CloseDialogEventArgs>(this, args);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Raises the CloseDialog event and performs custom processing</summary>
 /// <param name="args">CloseDialogEventArgs containing event data</param>
 protected virtual void OnCloseDialog(CloseDialogEventArgs args)
 {
     RaiseCloseDialog(args);
 }
Exemplo n.º 13
0
 private void ViewModel_CloseDialog(object sender, CloseDialogEventArgs e)
 {
     DialogResult = e.DialogResult;
     Close();
 }
Exemplo n.º 14
0
        protected override void OnCloseDialog(CloseDialogEventArgs args)
        {
            base.OnCloseDialog(args);
            if (args.DialogResult == true)
            {
                // check out files that are locally modified but not opened
                foreach (var item in m_modified)
                {
                    if (item.IsChecked)
                        m_sourceControlService.CheckOut(item.Uri);
                }

                // add files that are missing in the depot
                foreach (var item in m_notInDepot)
                {
                    if (item.IsChecked)
                        m_sourceControlService.Add(item.Uri);
                }
            }
        }