public void AddTab() { var block = new TimelineBlock { Name = "新しいタブ" }; MukyutterClient.Current.BlockItems.Add(block); var viewmodel = this.TabItems.FirstOrDefault(t => t.Block == block) as TimelineTabViewModel; if (viewmodel != null) { viewmodel.IsConfigMode = true; this.SelectedTabItem = viewmodel; } }
public MainWindowViewModel(MainWindowSettings settings) : base(settings) { this.Title = "Mukyutter; Silent Selene (beta)"; if (!this.IsInDesignMode) { this.CompositeDisposable.Add(new PropertyChangedEventListener(MukyutterClient.Current.NotificationService) { { "NotificationMessage", (sender, e) => this.Notify(MukyutterClient.Current.NotificationService.NotificationMessage) }, }); this.Composer = new ComposerViewModel(MukyutterClient.Current.Composer); this.TabItems = ViewModelHelper.CreateReadOnlyDispatcherCollection( MukyutterClient.Current.BlockItems, tab => tab.ToTabViewModel(), DispatcherHelper.UIDispatcher); this.CompositeDisposable.Add(this.TabItems); this.SysTabItems = new DispatcherCollection<TabViewModel>(DispatcherHelper.UIDispatcher) { new SystemTabViewModel(), new EventTabViewModel(), #region DEBUG only #if DEBUG new DevTabViewModel(), #endif #endregion }; this.SelectedTabItem = this.TabItems.FirstOrDefault(); this.IsNotificationOverlay = true; } }