Exemplo n.º 1
0
        private void SaveSelections()
        {
            fSlideShow.Pause();
            fSlideShow.SelectedDirectories = fFolderView.GetCheckedPaths();
            fSlideShow.CurrentSlidePath    = fBookmark;
            Close();

            SlideShowWindow window = Parent as SlideShowWindow;

            if (window != null)
            {
                window.SaveState();
            }
            fSlideShow.Start(1);
        }
Exemplo n.º 2
0
        private void DoCommand(ListBoxItem item)
        {
            Debug.WriteLine("DoCommand({0})", item.Content, 0);
            CommandKey ck = item.Resources["Cmd"] as CommandKey;

            if (ck != null)
            {
                SlideShowWindow owner = Owner as SlideShowWindow;
                if (owner != null)
                {
                    owner.KeyCommand((Key)ck.KbKey);
                }
            }

            Close();
        }
Exemplo n.º 3
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Escape:
                Close();
                break;

            // If these made it here, the ListBox doesn't have focus
            case Key.Up:
            case Key.Down:
            case Key.Right:
            case Key.Left:
                ((ListBoxItem)fListBox.Items[0]).Focus();
                e.Handled = true;
                break;

            case Key.Enter:
                if (fListBox.SelectedItems.Count > 0)
                {
                    ListBoxItem item = fListBox.SelectedItems[0] as ListBoxItem;
                    if (item != null)
                    {
                        DoCommand(item);
                    }
                }
                e.Handled = true;
                break;

            default:
            {
                SlideShowWindow owner = Owner as SlideShowWindow;
                if (owner != null)
                {
                    if (owner.KeyCommand(e.Key))
                    {
                        e.Handled = true;
                        Close();
                    }
                }
            }
                base.OnKeyDown(e);
                break;
            }
        }
Exemplo n.º 4
0
        public App()
        {
            bool firstInstance;

            fAppMutex = new Mutex(true, cMutexName, out firstInstance);
            if (!firstInstance)
            {
                Debug.WriteLine("Instance already running.");
                Shutdown();
                return;
            }

            //InitializeComponent();

#if DEBUG && false
            FolderTreeEnumerator.Test();
#endif
            bool   noShow      = false;
            bool   syntaxError = false;
            string rootPath    = null;
            {
                string[] commandLineArgs = Environment.GetCommandLineArgs();

                fIsScreenSaver = System.IO.Path.GetExtension(commandLineArgs[0]).Equals(".scr", StringComparison.OrdinalIgnoreCase);

                IEnumerator p = commandLineArgs.GetEnumerator();
                p.MoveNext();                 // Skip exe name
                while (p.MoveNext())
                {
                    string arg = p.Current as string;
                    if (arg[0] == '-' || arg[0] == '/')
                    {
                        int colon = arg.IndexOf(':');

                        string option;
                        string value;
                        if (colon >= 0)
                        {
                            option = arg.Substring(1, colon - 1).ToLower();
                            value  = arg.Substring(colon + 1);
                        }
                        else
                        {
                            option = arg.Substring(1).ToLower();
                            value  = null;
                        }

                        switch (option)
                        {
                        case "c":                                 // Screen saver configuration
                            MessageBox.Show("Right-click on the screen saver while it's running to change configuration.");
                            noShow = true;
                            break;

                        case "s":                                 // Screen saver show
                            break;                                // do nothing

                        default:
                            syntaxError = true;
                            noShow      = true;
                            break;
                        }
                    }
                    else if (rootPath == null)
                    {
                        rootPath = arg;
                    }
                    else
                    {
                        syntaxError = true;
                        noShow      = true;
                    }
                }
            }

            if (syntaxError)
            {
                MessageBox.Show(cSyntax);
            }
            if (noShow)
            {
                return;
            }

            SlideShowWindow mainWindow = new SlideShowWindow();
            mainWindow.Height = 800;                    // QQQ Maximize the window here
            mainWindow.Width  = 800;
            mainWindow.LoadState();
            if (rootPath != null)
            {
                if (!string.Equals(mainWindow.RootPath, rootPath, StringComparison.OrdinalIgnoreCase))
                {
                    mainWindow.SelectedDirectories = new string[] { rootPath };
                }
                mainWindow.RootPath = rootPath;
            }
            mainWindow.Show();
            mainWindow.Start();

            //Window otherWindow = new Window1();
            //otherWindow.Show();
        }