Пример #1
0
        private void SaveHandler(object sender, EventArgs e)
        {
            cancellationToken.Cancel = false;

            //Istnieje konieczność ukrycia widoku inaczej nie zniknie on gdy ma miejsce sytuacja taka jak tu,
            //gdy zamykamy jeden blokujący widok okna a otwieramy zaraz następny.
            ViewManager.HideView(View);

            var subtitlesPath = subtitlesManager.CurrentSubtitles.Path;

            if (subtitlesPath != null)
            {
                subtitlesManager.Save();
            }
            else
            {
                ISaveFileView     saveFileView      = new SaveFileView();
                SaveFilePresenter saveFilePresenter = new SaveFilePresenter(ViewManager, saveFileView, subtitlesManager, cancellationToken);

                //Dodajemy widok zapisu do głównego widoku, żeby został wyświetlony jako widok podrzędny w stosutnku do niego.
                var mainView = (Subeditor.Views.Main.MainFormView)ViewManager.GetView(Subeditor.Properties.Resources.NameMainView);
                mainView.AddChildView(saveFileView);

                ViewManager.AddView(saveFileView);
                ViewManager.ShowView(saveFileView);
                ViewManager.CloseView(saveFileView);
                ViewManager.RemoveView(saveFileView);
            }

            ViewManager.CloseView(View);
        }
Пример #2
0
 public void Execute()
 {
     if (Path != null)
     {
         subtitlesManager.CurrentSubtitles.Path = Path;
     }
     subtitlesManager.Save();
 }
Пример #3
0
 private void DialogClosedHandler(object sender, KWinFramework.Views.WinForms.Dialogs.DialogClosedEventArgs e)
 {
     if (e.DialogViewResult == KWinFramework.Views.WinForms.Dialogs.DialogViewResult.Ok)
     {
         subtitlesManager.CurrentSubtitles.Path = View.FileName;
         subtitlesManager.Save();
     }
     else if (e.DialogViewResult == KWinFramework.Views.WinForms.Dialogs.DialogViewResult.Cancel)
     {
         if (cancellationToken != null)
         {
             cancellationToken.Cancel = true;
         }
     }
 }
Пример #4
0
        /// <summary>
        /// Metoda wywoływana w momencie odpalenia polecenia.
        /// </summary>
        protected override void OnExecute()
        {
            var subtitlesPath = subtitlesManager.CurrentSubtitles.Path;

            if (subtitlesPath != null)
            {
                subtitlesManager.Save();
            }
            else
            {
                ISaveFileView     saveFileView      = new SaveFileView();
                SaveFilePresenter saveFilePresenter = new SaveFilePresenter(ViewManager, saveFileView, subtitlesManager);

                ViewManager.AddView(saveFileView);
                ViewManager.ShowView(saveFileView);
                ViewManager.CloseView(saveFileView);
                ViewManager.RemoveView(saveFileView);
            }
        }