예제 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            if (e.Args.Length == 0)
            {
                new MainWindow().Show();
            }
            else
            {
                switch (e.Args[0].ToLower())
                {
                case "-?":
                case "-h":
                case "-help":
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendLine("-?\t Help");
                    stringBuilder.AppendLine("-h\t Help");
                    stringBuilder.AppendLine("-help\t Help");
                    stringBuilder.AppendLine("-uninstall\t Uninstall all registered service suppoets of Bili-dl " +
                                             " \t\t\t included the Shortcut in Start menu");
                    MessageBox.Show(stringBuilder.ToString());
                    Environment.Exit(0);
                    break;

                case "-uninstall":
                    NotificationManager.Uninstall();
                    MessageBox.Show("Uninstalled successfully");
                    Environment.Exit(0);
                    break;

                case "-update":
                    UpdateUtil.RunUpdate();
                    Environment.Exit(0);
                    break;

                default:
                    if (e.Args[0] == NotificationManager.ToastActivatedLaunchArg)
                    {
                        ToastHandler.CmdMode           = true;
                        NotificationManager.Activated += ToastHandler.HandleToast;
                        NotificationManager.Install();
                    }
                    else
                    {
                        MessageBox.Show("Invalid arguments");
                        Environment.Exit(0);
                    }
                    break;
                }
            }
        }
예제 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Enable the minimize animation
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));

            NotificationManager.Activated += ToastHandler.HandleToast;
            NotificationManager.Install();

            LoadConfig();

            UpdateUtil.NewVersionFound += UpdateUtil_NewVersionFound;
            UpdateUtil.StartCheckVersion();
        }
예제 #3
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     DownloadFinishedNotification.DisposeNotifyIcon();
     NotificationManager.Close();
     UpdateUtil.StopCheckVersion();
     DownloadManager.StopAll();
     SettingPanel.Settings settings = ConfigUtil.ConfigManager.GetSettings();
     if (settings.MovedTempPath != null && settings.MovedTempPath != settings.TempPath)
     {
         CopyDirectory(settings.TempPath, settings.MovedTempPath);
         settings.TempPath      = settings.MovedTempPath;
         settings.MovedTempPath = null;
         ConfigUtil.ConfigManager.SetSettings(settings);
     }
 }
예제 #4
0
 private void NowBtn_Click(object sender, RoutedEventArgs e)
 {
     ((Grid)this.Parent).Children.Remove(this);
     UpdateUtil.RunUpdate();
     Confirmed?.Invoke(true);
 }