Example #1
0
        /// <summary>
        /// タブを指定したタブの前に追加します。
        /// </summary>
        /// <param name="insert">追加するタブ</param>
        /// <param name="beforeThis">このタブの前に追加、nullなら末尾に追加</param>
        public void InsertBefore(TabViewModel insert, TabViewModel beforeThis)
        {
            // インデックス取得
            int idx = -1;

            if (beforeThis != null)
            {
                idx = this._tabItems.IndexOf(beforeThis);
            }

            if (idx == -1)
            {
                this._tabItems.Add(insert);
            }
            else
            {
                this._tabItems.Insert(idx, insert);
            }

            // タブの保持カラムを更新し、イベントハンドラを連結する
            insert.SetTabOwner(this);
            insert.GotFocus += OnTabGotFocus;

            // 一つ目のタブであればそのタブを選択する
            if (this._tabItems.Count == 1)
            {
                SelectedTabViewModel = insert;
            }

            // タブ変更のコミット
            insert.InvalidateCache();
        }
Example #2
0
        /// <summary>
        /// タブをこのカラムの末尾に追加します。
        /// </summary>
        public TabViewModel AddTab(TabProperty tabProperty = null)
        {
            var nvm = new TabViewModel(this, tabProperty);

            this.AddTab(nvm);
            return(nvm);
        }
Example #3
0
        protected void OnSelectedTabChanged(TabViewModel selected)
        {
            var stc = this.SelectedTabChanged;

            if (stc != null)
            {
                stc(selected);
            }
        }
Example #4
0
 /// <summary>
 /// 閉じタブスタックにタブをプッシュします。<para />
 /// IsAliveのステート変更は行いますが、クエリやリストの購読解除は呼び出し側で行う必要があります。
 /// </summary>
 public void PushClosedTabStack(TabViewModel viewmodel)
 {
     // タブを殺す
     viewmodel.IsAlive = false;
     lock (this._ctsLock)
     {
         this._closedTabStacks.Push(viewmodel);
     }
     this._columns.ForEach(c => c.RebirthTabCommand.RaiseCanExecuteChanged());
 }
 public UserPageViewModel(TabViewModel parent, string userId)
 {
     this.Parent = parent;
     this._timelineListCoreViewModel = new TimelineListCoreViewModel(parent, new IFilter[0]);
     this.SetUser(userId);
     ViewModelHelper.BindNotification(Setting.SettingValueChangedEvent, this, (_, __) =>
     {
         RaisePropertyChanged(() => UserProfileBackground);
         RaisePropertyChanged(() => UserProfileDarkBackground);
     });
 }
Example #6
0
 public UserPageViewModel(TabViewModel parent, string userId)
 {
     this.Parent = parent;
     this._timelineListCoreViewModel = new TimelineListCoreViewModel(parent, new IFilter[0]);
     this.SetUser(userId);
     ViewModelHelper.BindNotification(Setting.SettingValueChangedEvent, this, (_, __) =>
     {
         RaisePropertyChanged(() => UserProfileBackground);
         RaisePropertyChanged(() => UserProfileDarkBackground);
     });
 }
 public TimelineListCoreViewModel(TabViewModel parent, IEnumerable<IFilter> sources)
 {
     if (parent == null)
         throw new ArgumentNullException("parent");
     this._tweetsSource = new CachedConcurrentObservableCollection<TabDependentTweetViewModel>();
     this.Parent = parent;
     this.sources = sources;
     UpdateReacceptionChain(sources, true);
     // binding nortifications
     ViewModelHelper.BindNotification(TweetStorage.TweetStorageChangedEvent, this, TweetStorageChanged);
     ViewModelHelper.BindNotification(Setting.SettingValueChangedEvent, this, SettingValueChanged);
     // Generate timeline
     Task.Factory.StartNew(() => this.InvalidateCache());
 }
Example #8
0
 public TimelineListCoreViewModel(TabViewModel parent, IEnumerable <IFilter> sources)
 {
     if (parent == null)
     {
         throw new ArgumentNullException("parent");
     }
     this._tweetsSource = new CachedConcurrentObservableCollection <TabDependentTweetViewModel>();
     this.Parent        = parent;
     this.sources       = sources;
     UpdateReacceptionChain(sources, true);
     // binding nortifications
     ViewModelHelper.BindNotification(TweetStorage.TweetStorageChangedEvent, this, TweetStorageChanged);
     ViewModelHelper.BindNotification(Setting.SettingValueChangedEvent, this, SettingValueChanged);
     // Generate timeline
     Task.Factory.StartNew(() => this.InvalidateCache());
 }
Example #9
0
 public void RemoveTab(TabViewModel tabViewModel)
 {
     if (this._tabItems.Remove(tabViewModel))
     {
         // イベントハンドラを解除
         tabViewModel.GotFocus -= OnTabGotFocus;
         if (this._tabItems.Count > 0)
         {
             SelectedTabViewModel = this._tabItems[0];
         }
         else
         {
             SelectedTabViewModel = null;
         }
     }
 }
Example #10
0
        public void CloseTab(TabViewModel tabViewModel)
        {
            RemoveTab(tabViewModel);
            // cleanup additional receiver
            foreach (var query in tabViewModel.TabProperty.StreamingQueries)
            {
                ConnectionManager.RemoveQuery(query);
            }

            foreach (var list in tabViewModel.TabProperty.FollowingLists)
            {
                var split = list.Split('/');
                ListReceiverManager.RemoveReceive(split[0], split[1]);
            }
            this.Parent.PushClosedTabStack(tabViewModel);
            this.Parent.GCColumn();
        }
Example #11
0
 public UserPageViewModel(TabViewModel parent, string userId)
 {
     this.Parent = parent;
     this._timelineListCoreViewModel = new TimelineListCoreViewModel(parent, new IFilter[0]);
     this.SetUser(userId);
 }
Example #12
0
        /// <summary>
        /// タブを指定したタブの前に追加します。
        /// </summary>
        /// <param name="insert">追加するタブ</param>
        /// <param name="beforeThis">このタブの前に追加、nullなら末尾に追加</param>
        public void InsertBefore(TabViewModel insert, TabViewModel beforeThis)
        {
            // インデックス取得
            int idx = -1;
            if (beforeThis != null)
                idx = this._tabItems.IndexOf(beforeThis);

            if (idx == -1)
                this._tabItems.Add(insert);
            else
                this._tabItems.Insert(idx, insert);

            // タブの保持カラムを更新し、イベントハンドラを連結する
            insert.SetTabOwner(this);
            insert.GotFocus += OnTabGotFocus;

            // 一つ目のタブであればそのタブを選択する
            if (this._tabItems.Count == 1)
                SelectedTabViewModel = insert;

            // タブ変更のコミット
            insert.InvalidateCache();
        }
Example #13
0
 /// <summary>
 /// タブをこのカラムの末尾に追加します。
 /// </summary>
 public TabViewModel AddTab(TabProperty tabProperty = null)
 {
     var nvm = new TabViewModel(this, tabProperty);
     this.AddTab(nvm);
     return nvm;
 }
Example #14
0
 /// <summary>
 /// タブをこのカラムの末尾に追加します。
 /// </summary>
 public void AddTab(TabViewModel tabViewModel)
 {
     InsertBefore(tabViewModel, null);
 }
Example #15
0
        public void CloseTab(TabViewModel tabViewModel)
        {
            RemoveTab(tabViewModel);
            // cleanup additional receiver
            foreach (var query in tabViewModel.TabProperty.StreamingQueries)
            {
                ConnectionManager.RemoveQuery(query);
            }

            foreach (var list in tabViewModel.TabProperty.FollowingLists)
            {
                var split = list.Split('/');
                ListReceiverManager.RemoveReceive(split[0], split[1]);
            }
            this.Parent.PushClosedTabStack(tabViewModel);
            this.Parent.GCColumn();
        }
Example #16
0
 /// <summary>
 /// タブをこのカラムの末尾に追加します。
 /// </summary>
 public void AddTab(TabViewModel tabViewModel)
 {
     InsertBefore(tabViewModel, null);
 }
Example #17
0
 void CurrentTabChanged(TabViewModel tab)
 {
     this.SetCurrentTab(tab);
 }
Example #18
0
 /// <summary>
 /// 閉じタブスタックにタブをプッシュします。<para />
 /// IsAliveのステート変更は行いますが、クエリやリストの購読解除は呼び出し側で行う必要があります。
 /// </summary>
 public void PushClosedTabStack(TabViewModel viewmodel)
 {
     // タブを殺す
     viewmodel.IsAlive = false;
     lock (this._ctsLock)
     {
         this._closedTabStacks.Push(viewmodel);
     }
     this._columns.ForEach(c => c.RebirthTabCommand.RaiseCanExecuteChanged());
 }
Example #19
0
 public void SetCurrentTab(TabViewModel tvm)
 {
     if (tvm != null)
         this.UserSelectorViewModel.LinkElements = tvm.TabProperty.LinkAccountInfos;
     else
         this.UserSelectorViewModel.LinkElements = AccountStorage.Accounts;
     UpdateAccountImages();
 }
Example #20
0
 public TimelineListViewModel(TabViewModel parent, IEnumerable <IFilter> sources)
 {
     this.Parent = parent;
     this._timelineListCoreViewModel = new TimelineListCoreViewModel(parent, sources);
 }
Example #21
0
 public void EditTab(TabViewModel vm)
 {
     vm.TabProperty = ShowTabEditor(vm.TabProperty);
     vm.InvalidateTabProperty();
     vm.InvalidateCache();
 }
Example #22
0
 public bool Contains(TabViewModel tabViewModel)
 {
     return this._tabItems.Contains(tabViewModel);
 }
Example #23
0
 public void EditTab(TabViewModel vm)
 {
     vm.TabProperty = ShowTabEditor(vm.TabProperty);
     vm.InvalidateTabProperty();
     vm.InvalidateCache();
 }
Example #24
0
 public bool Contains(TabViewModel tabViewModel)
 {
     return(this._tabItems.Contains(tabViewModel));
 }
Example #25
0
 public void RemoveTab(TabViewModel tabViewModel)
 {
     if (this._tabItems.Remove(tabViewModel))
     {
         // イベントハンドラを解除
         tabViewModel.GotFocus -= OnTabGotFocus;
         if (this._tabItems.Count > 0)
             SelectedTabViewModel = this._tabItems[0];
         else
             SelectedTabViewModel = null;
     }
 }
Example #26
0
 protected void OnSelectedTabChanged(TabViewModel selected)
 {
     var stc = this.SelectedTabChanged;
     if (stc != null)
         stc(selected);
 }
Example #27
0
 public TimelineListViewModel(TabViewModel parent, IEnumerable<IFilter> sources)
 {
     this.Parent = parent;
     this._timelineListCoreViewModel = new TimelineListCoreViewModel(parent, sources);
 }