Exemple #1
0
        public ExpeditionViewModel(Expedition expedition)
        {
            this.source = expedition;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(expedition, (sender, args) => this.RaisePropertyChanged(args.PropertyName)));

            if (Toast.IsSupported)
            {
                expedition.Returned += (sender, args) =>
                {
                    if (this.IsNotifyReturned)
                    {
                        Toast.Show(
                            "Expedition",
                            args.FleetName + " has returned from the expedition.",
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                expedition.Returned += (sender, args) =>
                {
                    if (this.IsNotifyReturned)
                    {
                        NotifyIconWrapper.Show(
                            "Expedition",
                            args.FleetName + " has returned from the expedition.");
                    }
                };
            }
        }
Exemple #2
0
 /// <summary>
 /// Raises the Startup event
 /// </summary>
 /// <param name="e">A StartupEventArgs that contains the event data</param>
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     ShutdownMode = ShutdownMode.OnExplicitShutdown;
     notifyIcon   = new NotifyIconWrapper();
     WindowLocationStore.Initialize();
 }
        public BuildingDockViewModel(BuildingDock source)
        {
            this.source = source;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(source, (sender, args) => this.RaisePropertyChanged(args.PropertyName)));

            if (Toast.IsSupported)
            {
                source.Completed += (sender, args) =>
                {
                    if (this.IsNotifyCompleted)
                    {
                        Toast.Show(
                            "Building Dock",
                            string.Format("Construction of {1} in dock {0} is complete.", this.Id, this.CanDisplayShipName ? "" + this.Ship + "" : "ship"),
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                source.Completed += (sender, args) =>
                {
                    if (this.IsNotifyCompleted)
                    {
                        NotifyIconWrapper.Show(
                            "Building Dock",
                            string.Format("Construction of {1} in dock {0} is complete.", this.Id, this.CanDisplayShipName ? "" + this.Ship + "" : "ship"));
                    }
                };
            }
        }
        public RepairingDockViewModel(RepairingDock source)
        {
            this.source = source;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(source, (sender, args) => this.RaisePropertyChanged(args.PropertyName)));

            if (Toast.IsSupported)
            {
                source.Completed += (sender, args) =>
                {
                    if (this.IsNotifyCompleted)
                    {
                        Toast.Show(
                            "Repair Dock",
                            string.Format("Dock {0} has finished repairing {1}", this.Id, this.Ship),
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                source.Completed += (sender, args) =>
                {
                    if (this.IsNotifyCompleted)
                    {
                        NotifyIconWrapper.Show(
                            "Repair Dock",
                            string.Format("Dock {0} has finished repairing {1}", this.Id, this.Ship));
                    }
                };
            }
        }
 protected override void OnClosed(EventArgs e)
 {
     NotifyIcon?.Dispose();
     NotifyIcon = null;
     CompositeDisposable.Dispose();
     base.OnClosed(e);
 }
Exemple #6
0
        /// <summary>
        /// System.Windows.Application.Startup イベント を発生させます。
        /// </summary>
        /// <param name="e">イベントデータ を格納している StartupEventArgs</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            this.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var vm = SqliteInitializer.Create();

            notifyIcon = new NotifyIconWrapper(vm);
        }
Exemple #7
0
        /// <summary>
        /// System.Windows.Application.Startup イベント を発生させます。
        /// </summary>
        /// <param name="e">イベントデータ を格納している StartupEventArgs</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            this.notifyIcon   = new NotifyIconWrapper(this);

            var window = new MainWindow();

            window.Show();
        }
Exemple #8
0
        protected override void OnExit(ExitEventArgs e)
        {
            base.OnExit(e);

            if (!Toast.IsSupported)
            {
                NotifyIconWrapper.Dispose();
            }
            KanColleClient.Current.Proxy.Shutdown();
            Settings.Current.Save();
        }
Exemple #9
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ConfigManager.LoadConf();

            this.replyToItem = new ReplyToItem();
            this.DataContext = this.replyToItem;
            this.textBlock_Remain.DataContext = this.inputText;
            this.textBlock_Media.DataContext  = this.media;

            AccountManager am = AccountManager.GetInstance();

            if (am.CurrentAccountIndex < 0)
            {
                AuthorizeWindow w       = new AuthorizeWindow();
                bool?           success = w.ShowDialog();
                if (success == true)
                {
                }
            }

            Account ac = am.GetAccount(am.CurrentAccountIndex);

            if (ac == null)
            {
                return;
            }

            this.account = ac;
            this.image_UserIcon.DataContext = this.account;

            this.timeLineViewer_Home.Initialize(this, this.account, TimeLineMode.Home);
            this.timeLineViewer_Home.SetTimeLine();
            this.timeLineViewer_Home.StartStreaming();

            this.timeLineViewer_Mention.Initialize(this, this.account, TimeLineMode.Mention);
            this.timeLineViewer_Mention.SetTimeLine();
            this.timeLineViewer_Mention.StartStreaming();

            this.timeLineViewer_Fav.Initialize(this, ac, TimeLineMode.Fav);
            this.timeLineViewer_Fav.SetTimeLine();
            this.timeLineViewer_Fav.StartStreaming();

            this.DmListViewer_DM.Initialize(this, ac);
            this.DmListViewer_DM.SetDirectMessage();
            // this.timeLineViewer_DM.StartStreaming();

            string titleText = "Mik_Twit - @" + this.account.ScreenName;

            this.title = new TitleTextItem(titleText);
            this.textBlock_Title.DataContext = title;

            this.TaskIcon = new NotifyIconWrapper();
        }
Exemple #10
0
        // Method
        protected override void OnStartup(StartupEventArgs e)
        {
            bool createNew;

            ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "DoorMonitorApp", out createNew);

            if (!createNew)
            {
                MessageBox.Show("Application already exit", "Information");
                App.Current.Shutdown();
                Environment.Exit(0);
            }

            base.OnStartup(e);

            this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            notifyIcon        = new NotifyIconWrapper();
        }
Exemple #11
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Done because exception was thrown before Main. Solution found here:
            // http://www.codeproject.com/Questions/184743/AssemblyResolve-event-not-hit
            TypeResolving.RegisterTypeResolving();
            ShutdownMode = ShutdownMode.OnExplicitShutdown;

            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += ExceptionHandler;

            _notifyIconComponent = new NotifyIconWrapper();
            _notifyIconComponent.StartAgentClick      += StartAgentThread;
            _notifyIconComponent.StopAgentClick       += StopAgentThread;
            _notifyIconComponent.SettingsAgentChanged += UpdateServerIpEndpoint;
        }
        public ServerWindow()
        {
            InitializeComponent();
            Utils.SetWindowProperties(this);
            NotifyIcon = new NotifyIconWrapper()
            {
                Window = this
            };
            CompositeDisposable = new LivetCompositeDisposable();

            var serverVM = DataContext as ServerViewModel;

            if (serverVM != null)
            {
                var modelListener = new PropertyChangedEventListener(serverVM);
                modelListener.Add(() => serverVM.WindowCaption, (_, __) => NotifyIcon.Text = serverVM.WindowCaption);
                CompositeDisposable.Add(modelListener);
            }
        }
Exemple #13
0
        /// <summary>
        /// アプリケーション開始時呼ばれる。
        /// </summary>
        /// <param name="e">イベントデータ</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            ShutdownMode = ShutdownMode.OnExplicitShutdown;

            // 前バージョンからのUpgradeを実行していないときは、Upgradeを実施する
            if (GitHubNotifier.Properties.Settings.Default.IsUpgraded == false)
            {
                // Upgradeを実行する
                GitHubNotifier.Properties.Settings.Default.Upgrade();
                // 「Upgradeを実行した」という情報を設定する
                GitHubNotifier.Properties.Settings.Default.IsUpgraded = true;
                // 現行バージョンの設定を保存する
                GitHubNotifier.Properties.Settings.Default.Save();
            }

            // NotifyIconを初期化
            Uri iconUri = new Uri("pack://application:,,,/GitHubNotifier;component/Resources/NotifyIconWhite.ico");
            ContextMenuStrip  contextMenu           = new ContextMenuStrip();
            ToolStripMenuItem toolStripMenuItemOpen = new ToolStripMenuItem("Open", null, ToolStripMenuItemOpen_Click);
            ToolStripMenuItem toolStripMenuItemExit = new ToolStripMenuItem("Exit", null, ToolStripMenuItemExit_Click);

            contextMenu.Items.AddRange(new ToolStripItem[]
            {
                toolStripMenuItemOpen,
                toolStripMenuItemExit
            });
            notifyIcon              = new NotifyIconWrapper(iconUri, "GitHub Notifier", contextMenu);
            notifyIcon.DoubleClick += NotifyIcon_DoubleClick;

            // NotificationServiceを初期化
            notificationService = new NotificationService();
            // アクセス情報検証済みの場合通知の取得を開始
            if (GitHubNotifier.Properties.Settings.Default.IsValidated)
            {
                notificationService.Run();
            }
        }
Exemple #14
0
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            if (Toast.IsSupported)
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        Toast.Show(
                            "Morale Recovery",
                            "Morale of ships in the " + parent.Name + "has fully recovered.",
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        NotifyIconWrapper.Show(
                            "Morale Recovery",
                            "Morale of ships in the " + parent.Name + "has fully recovered.");
                    }
                };
            }
        }
Exemple #15
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            this.DispatcherUnhandledException += (sender, args) => ReportException(sender, args.Exception);

            DispatcherHelper.UIDispatcher = this.Dispatcher;
            Helper.SetRegistryFeatureBrowserEmulation();
            KanColleClient.Current.Proxy.Startup(AppSettings.Default.LocalProxyPort);
            Settings.Load();

            ProductInfo = new ProductInfo();

            var proxy = KanColleClient.Current.Proxy;

            proxy.UpstreamProxyHost    = Settings.Current.ProxyHost;
            proxy.UpstreamProxyPort    = Settings.Current.ProxyPort;
            proxy.UseProxyOnConnect    = Settings.Current.EnableProxy;
            proxy.UseProxyOnSSLConnect = Settings.Current.EnableSSLProxy;

            if (Toast.IsSupported)
            {
                Toast.TryInstallShortcut();
            }
            else
            {
                NotifyIconWrapper.Initialize();
            }

            ThemeService.Current.Initialize(this);

            ViewModelRoot   = new MainWindowViewModel();
            this.MainWindow = new MainWindow {
                DataContext = ViewModelRoot
            };
            this.MainWindow.Show();
        }
Exemple #16
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     NotifyIcon?.Dispose();
     NotifyIcon = null;
 }
 /// <summary>
 /// System.Windows.Application.Startup イベント を発生させます。
 /// </summary>
 /// <param name="e">イベントデータ を格納している StartupEventArgs</param>
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
     this.notifyIcon   = new NotifyIconWrapper();
 }