/// <summary> /// Find column info where existed. /// </summary> /// <param name="column">find column</param> /// <returns>If found, returns >= 0. Otherwise, return -1.</returns> public static int FindColumnIndex(ColumnModel column) { for (var ci = 0; ci < _columns.Count; ci++) { if (_columns[ci] == column) { return ci; } } return -1; }
public ColumnViewModel(MainAreaViewModel parent, ColumnModel model) { this._parent = parent; this._model = model; this.CompositeDisposable.Add( this._tabs = ViewModelHelperRx.CreateReadOnlyDispatcherCollectionRx( model.Tabs, _ => new TabViewModel(this, _), DispatcherHelper.UIDispatcher)); this.CompositeDisposable.Add( Observable.FromEvent( h => this._model.CurrentFocusTabChanged += h, h => this._model.CurrentFocusTabChanged -= h) .Select(_ => this._model.CurrentFocusTabIndex) .Subscribe(this.UpdateFocusFromModel)); this.CompositeDisposable.Add( _tabs.ListenCollectionChanged().Subscribe(_ => this._tabs.ForEach(item => item.UpdateFocus()))); if (this._tabs.Count > 0) { this.FocusedTab = this._tabs[0]; } }