public MainWindow() { InitializeComponent(); vm = DataContext as MainWindowViewModel; composite = new LivetCompositeDisposable(); ctxlistener = new PropertyChangedWeakEventListener(vm); ctxlistener.Add("AccessTokenRequest", StartAccountSelect); ctxlistener.Add("ReplyStart", ExpandNewTweet); ctxlistener.Add("ToggleNewStatus", ToggleNewTweet); ctxlistener.Add("StatusAction", (s, e) => RequestAction(vm.StatusAction.Type, vm.StatusAction.Information)); ctxlistener.Add("UserTimeline", (s, e) => AddTab("ユーザー定義タブ1", new Frame { NavigationUIVisibility = NavigationUIVisibility.Hidden, Content = new UserCustomizableTimelinePage(vm.UserTimelineViewModel) }, vm.UserTimelineViewModel)); ctxlistener.Add("StatusUpdate", (s, e) => { DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => { if (TabControlMain.SelectedIndex != 0 && setting.MainWindow.NotifyNewStatus) { EmphasisTextBlock(TextBlockTimeline); urs++; TextBlockUnreadStatuses.Text = String.Format(" {0}", urs); } })); }); ctxlistener.Add("EventUpdate", (s, e) => { DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => { if (TabControlMain.SelectedIndex != 1 && setting.MainWindow.NotifyNewNotification) { EmphasisTextBlock(TextBlockNotification); urn++; TextBlockUnreadNotifications.Text = String.Format(" {0}", urn); } })); }); composite.Add(ctxlistener); setting = Kbtter3Extension.LoadJson <Kbtter3Setting>(App.ConfigurationFileName); if (!setting.MainWindow.AllowJokeCommands) { ToolBarJokes.Visibility = Visibility.Collapsed; } SetShortcuts(); }
public ReadOnlyNotifyChangedCollection(ISynchronizableNotifyChangedCollection <T> collection) : base(collection) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } EventListeners = new LivetCompositeDisposable(); _isDisposableType = typeof(IDisposable).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()); lock (collection.Synchronizer.LockObject) { SourceCollection = collection; EventListeners.Add(new PropertyChangedWeakEventListener(SourceCollection, (sender, e) => OnPropertyChanged(e))); EventListeners.Add(new CollectionChangedWeakEventListener(SourceCollection, (sender, e) => OnCollectionChanged(e))); } }
/// <summary> /// 入渠ドックに変化があったとき呼ばれる /// </summary> /// <param name="repairyard">repairyard</param> private void UpdateRepairyard(Repairyard repairyard) { Repairyard = repairyard; this.repairyardDisposables?.Dispose(); this.repairyardDisposables = new LivetCompositeDisposable(); foreach (var dock in repairyard.Docks.Values) { repairyardDisposables.Add(dock.Subscribe(nameof(dock.State), () => RepairState = dock.State)); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); /* * var provider = Provider.Local; * provider.Load(); * compositeDisposable.Add(provider.Save); */ var manager = LaunchableManager.Instance; compositeDisposable.Add(manager.Save); this.MainWindow = new MainWindow(); MainWindow.DataContext = new MainWindowViewModel(); this.MainWindow.Show(); }
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); } }
public MainWindow() { InitializeComponent(); vm = DataContext as MainWindowViewModel; composite = new LivetCompositeDisposable(); ctxlistener = new PropertyChangedWeakEventListener(vm); ctxlistener.Add("AccessTokenRequest", StartAccountSelect); ctxlistener.Add("ReplyStart", ExpandNewTweet); ctxlistener.Add("ToggleNewStatus", ToggleNewTweet); ctxlistener.Add("StatusAction", (s, e) => RequestAction(vm.StatusAction.Type, vm.StatusAction.Information)); ctxlistener.Add("UserTimeline", (s, e) => AddTab("ユーザー定義タブ1", new Frame { NavigationUIVisibility = NavigationUIVisibility.Hidden, Content = new UserCustomizableTimelinePage(vm.UserTimelineViewModel) }, vm.UserTimelineViewModel)); ctxlistener.Add("StatusUpdate", (s, e) => { DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => { if (TabControlMain.SelectedIndex != 0 && setting.MainWindow.NotifyNewStatus) { EmphasisTextBlock(TextBlockTimeline); urs++; TextBlockUnreadStatuses.Text = String.Format(" {0}", urs); } })); }); ctxlistener.Add("EventUpdate", (s, e) => { DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => { if (TabControlMain.SelectedIndex != 1 && setting.MainWindow.NotifyNewNotification) { EmphasisTextBlock(TextBlockNotification); urn++; TextBlockUnreadNotifications.Text = String.Format(" {0}", urn); } })); }); composite.Add(ctxlistener); setting = Kbtter3Extension.LoadJson<Kbtter3Setting>(App.ConfigurationFileName); if (!setting.MainWindow.AllowJokeCommands) ToolBarJokes.Visibility = Visibility.Collapsed; SetShortcuts(); }