Пример #1
0
        private void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command == ApplicationCommands.Open)
            {
                OpenPortfolio();
            }
            else if (e.Command == ApplicationCommands.Save)
            {
                SavePortfolio();
            }
            else if (e.Command == ApplicationCommands.SaveAs)
            {
                SavePortfolioAs();
            }
            else if (e.Command == ApplicationCommands.New)
            {
                NewPortfolio();
            }
            else if (e.Command == NavigationCommands.Refresh)
            {
                ReloadActiveMedia();
            }
            else if (e.Command == CustomCommands.Exit)
            {
                this.Close();
            }
            else if (e.Command == ApplicationCommands.Find)
            {
                Controller.ShowSongList();
            }
            else if (e.Command == CustomCommands.SwitchWindow)
            {
                Controller.ShowEditorWindow();
            }
            else if (e.Command == CustomCommands.EditActive)
            {
                var song = ActiveMedia as SongMedia;
                if (song != null)
                {
                    EditorWindow win = Controller.ShowEditorWindow();
                    win.LoadOrImport(song.Uri);
                }
            }
            else if (e.Command == CustomCommands.ShowSettings)
            {
                ShowSettingsWindow();
            }
            else if (e.Command == CustomCommands.ChoosePresentationArea)
            {
                ShowPresentationAreaSettingsWindow();
            }
            else if (e.Command == CustomCommands.AddMedia)
            {
                ShowAddMediaDialog();
            }
            else if (e.Command == CustomCommands.HidePresentation)
            {
                Controller.PresentationManager.Status = PresentationStatus.Hide;
            }
            else if (e.Command == CustomCommands.Blackscreen)
            {
                Controller.PresentationManager.Status = PresentationStatus.Blackscreen;
            }
            else if (e.Command == CustomCommands.ShowPresentation)
            {
                Controller.PresentationManager.Status = PresentationStatus.Show;
            }
            else if (e.Command == CustomCommands.ToggleBlackscreen)
            {
                var canShow = Controller.PresentationManager.CurrentPresentation != null;

                if (Controller.PresentationManager.Status == PresentationStatus.Blackscreen && canShow)
                {
                    Controller.PresentationManager.Status = PresentationStatus.Show;
                }
                else
                {
                    Controller.PresentationManager.Status = PresentationStatus.Blackscreen;
                }
            }
            else if (e.Command == CustomCommands.ShowTestImage)
            {
                orderList.ActiveItem = null;
                Controller.PresentationManager.CurrentPresentation = Controller.PresentationManager.CreatePresentation <TestPresentation>();
                Controller.PresentationManager.Status = PresentationStatus.Show;
            }
            else if (e.Command == CustomCommands.ShowNotification)
            {
                NotificationController.Instance.ShowSettingsWindow();
            }
            else if (e.Command == ApplicationCommands.Help)
            {
                Process.Start("http://wordslive.org/manual/");
            }
            else if (e.Command == CustomCommands.CheckForUpdates)
            {
                Controller.CheckForUpdates(false);
            }
            else if (e.Command == CustomCommands.ShowAboutDialog)
            {
                var dlg = new AboutDialog();
                dlg.Owner = this;
                dlg.ShowDialog();
            }
            else if (e.Command == CustomCommands.CreateSlideshow)
            {
                var dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.DefaultExt       = ".show";
                dlg.Filter           = "Diashow|*.show";       // TODO: localize
                dlg.InitialDirectory = Properties.Settings.Default.LastMediaDirectory;

                if (dlg.ShowDialog() == true)
                {
                    Properties.Settings.Default.LastMediaDirectory = Path.GetDirectoryName(dlg.FileName);
                    var slideshowUri = new Uri(dlg.FileName);
                    var media        = new WordsLive.Images.ImagesMedia(slideshowUri);
                    media.CreateSlideshow(new Uri[] {});                     // create empty slideshow
                    Controller.AddToPortfolio(slideshowUri);
                }
            }
        }
Пример #2
0
        private void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command == ApplicationCommands.Open)
            {
                OpenPortfolio();
            }
            else if (e.Command == ApplicationCommands.Save)
            {
                SavePortfolio();
            }
            else if (e.Command == ApplicationCommands.SaveAs)
            {
                SavePortfolioAs();
            }
            else if (e.Command == ApplicationCommands.New)
            {
                NewPortfolio();
            }
            else if (e.Command == NavigationCommands.Refresh)
            {
                ReloadActiveMedia();
            }
            else if (e.Command == CustomCommands.Exit)
            {
                this.Close();
            }
            else if (e.Command == ApplicationCommands.Find)
            {
                Controller.ShowSongList();
            }
            else if (e.Command == CustomCommands.SwitchWindow)
            {
                Controller.ShowEditorWindow();
            }
            else if (e.Command == CustomCommands.EditActive)
            {
                var song = ActiveMedia as SongMedia;
                if (song != null)
                {
                    EditorWindow win = Controller.ShowEditorWindow();
                    win.LoadOrImport(song.Uri);
                }
            }
            else if (e.Command == CustomCommands.ShowSettings)
            {
                ShowSettingsWindow();
            }
            else if (e.Command == CustomCommands.ChoosePresentationArea)
            {
                ShowPresentationAreaSettingsWindow();
            }
            else if (e.Command == CustomCommands.AddMedia)
            {
                ShowAddMediaDialog();
            }
            else if (e.Command == CustomCommands.HidePresentation)
            {
                Controller.PresentationManager.Status = PresentationStatus.Hide;
            }
            else if (e.Command == CustomCommands.Blackscreen)
            {
                Controller.PresentationManager.Status = PresentationStatus.Blackscreen;
            }
            else if (e.Command == CustomCommands.ShowPresentation)
            {
                Controller.PresentationManager.Status = PresentationStatus.Show;
            }
            else if (e.Command == CustomCommands.ToggleBlackscreen)
            {
                var canShow = Controller.PresentationManager.CurrentPresentation != null;

                if (Controller.PresentationManager.Status == PresentationStatus.Blackscreen && canShow)
                {
                    Controller.PresentationManager.Status = PresentationStatus.Show;
                }
                else
                {
                    Controller.PresentationManager.Status = PresentationStatus.Blackscreen;
                }
            }
            else if (e.Command == CustomCommands.ShowTestImage)
            {
                orderList.ActiveItem = null;
                Controller.PresentationManager.CurrentPresentation = Controller.PresentationManager.CreatePresentation<TestPresentation>();
                Controller.PresentationManager.Status = PresentationStatus.Show;
            }
            else if (e.Command == CustomCommands.ShowNotification)
            {
                NotificationController.Instance.ShowSettingsWindow();
            }
            else if (e.Command == ApplicationCommands.Help)
            {
                Process.Start("http://wordslive.org/manual/");
            }
            else if (e.Command == CustomCommands.CheckForUpdates)
            {
                Controller.CheckForUpdates(false);
            }
            else if (e.Command == CustomCommands.ShowAboutDialog)
            {
                var dlg = new AboutDialog();
                dlg.Owner = this;
                dlg.ShowDialog();
            }
            else if (e.Command == CustomCommands.CreateSlideshow)
            {
                var dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.DefaultExt = ".show";
                dlg.Filter = "Diashow|*.show"; // TODO: localize
                dlg.InitialDirectory = Properties.Settings.Default.LastMediaDirectory;

                if (dlg.ShowDialog() == true)
                {
                    Properties.Settings.Default.LastMediaDirectory = Path.GetDirectoryName(dlg.FileName);
                    var slideshowUri = new Uri(dlg.FileName);
                    var media = new WordsLive.Images.ImagesMedia(slideshowUri);
                    media.CreateSlideshow(new Uri[] {}); // create empty slideshow
                    Controller.AddToPortfolio(slideshowUri);
                }
            }
        }