Exemplo n.º 1
0
 public ColumnViewModel(MainAreaViewModel parent, ColumnModel model)
 {
     _parent = parent;
     _model = model;
     this.CompositeDisposable.Add(
         _tabs = ViewModelHelper.CreateReadOnlyDispatcherCollection(
             model.Tabs,
             _ => new TabViewModel(this, _),
             DispatcherHelper.UIDispatcher));
     this.CompositeDisposable.Add(
         Observable.FromEvent(
         h => _model.OnCurrentFocusColumnChanged += h,
         h => _model.OnCurrentFocusColumnChanged -= h)
         .Select(_ => _model.CurrentFocusTabIndex)
         .Subscribe(UpdateFocusFromModel));
     if (_tabs.Count > 0)
     {
         Focused = _tabs[0];
     }
 }
Exemplo n.º 2
0
 /// <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;
 }