Ejemplo n.º 1
0
        private void About_Click(object sender, RoutedEventArgs e)
        {
            var win = new WinAbout();

            win.Show();
        }
Ejemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            try
            {
                string[] args = e.Args;

                if (args.Length == 0)
                {
                    MainWindow w = new MainWindow();
                    w.Show();
                    return;
                }

                EncryptionMode mode;
                if (!Enum.TryParse(args[0], out mode))
                {
                    MainWindow w = new MainWindow();
                    w.Show();
                    return;
                }

                string[] fileList = null;
                if (args.Length > 1)
                {
                    fileList = new string[args.Length - 1];
                    Array.Copy(args, 1, fileList, 0, args.Length - 1);
                }

                switch (mode)
                {
                case EncryptionMode.About:
                    WinAbout wAbout = new WinAbout();
                    SetWindowStartupPosition(wAbout);
                    wAbout.Show();
                    break;

                case EncryptionMode.CreateKey:
                    WinGenerateKey wCreateKey = new WinGenerateKey();
                    SetWindowStartupPosition(wCreateKey);
                    wCreateKey.Show();
                    break;

                case EncryptionMode.Open:
                case EncryptionMode.Encrypt:
                case EncryptionMode.Decrypt:
                    WinFileEncryption wEnc = new WinFileEncryption(fileList as IEnumerable <string>, mode);
                    SetWindowStartupPosition(wEnc);
                    wEnc.Show();
                    break;

                default:
                    MainWindow w = new MainWindow();
                    w.Show();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, caption: "PanMi");
            }
        }