Пример #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();
        }
Пример #2
0
        /// <summary>
        /// タブをこのカラムの末尾に追加します。
        /// </summary>
        public TabViewModel AddTab(TabProperty tabProperty = null)
        {
            var nvm = new TabViewModel(this, tabProperty);

            this.AddTab(nvm);
            return(nvm);
        }
Пример #3
0
        protected void OnSelectedTabChanged(TabViewModel selected)
        {
            var stc = this.SelectedTabChanged;

            if (stc != null)
            {
                stc(selected);
            }
        }
Пример #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());
 }
Пример #5
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);
     });
 }
Пример #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());
 }
Пример #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());
 }
Пример #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;
         }
     }
 }
Пример #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();
        }
Пример #11
0
 public UserPageViewModel(TabViewModel parent, string userId)
 {
     this.Parent = parent;
     this._timelineListCoreViewModel = new TimelineListCoreViewModel(parent, new IFilter[0]);
     this.SetUser(userId);
 }
Пример #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();
        }
Пример #13
0
 /// <summary>
 /// タブをこのカラムの末尾に追加します。
 /// </summary>
 public TabViewModel AddTab(TabProperty tabProperty = null)
 {
     var nvm = new TabViewModel(this, tabProperty);
     this.AddTab(nvm);
     return nvm;
 }
Пример #14
0
 /// <summary>
 /// タブをこのカラムの末尾に追加します。
 /// </summary>
 public void AddTab(TabViewModel tabViewModel)
 {
     InsertBefore(tabViewModel, null);
 }
Пример #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();
        }
Пример #16
0
 /// <summary>
 /// タブをこのカラムの末尾に追加します。
 /// </summary>
 public void AddTab(TabViewModel tabViewModel)
 {
     InsertBefore(tabViewModel, null);
 }
Пример #17
0
 void CurrentTabChanged(TabViewModel tab)
 {
     this.SetCurrentTab(tab);
 }
Пример #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());
 }
Пример #19
0
 public void SetCurrentTab(TabViewModel tvm)
 {
     if (tvm != null)
         this.UserSelectorViewModel.LinkElements = tvm.TabProperty.LinkAccountInfos;
     else
         this.UserSelectorViewModel.LinkElements = AccountStorage.Accounts;
     UpdateAccountImages();
 }
Пример #20
0
 public TimelineListViewModel(TabViewModel parent, IEnumerable <IFilter> sources)
 {
     this.Parent = parent;
     this._timelineListCoreViewModel = new TimelineListCoreViewModel(parent, sources);
 }
Пример #21
0
 public void EditTab(TabViewModel vm)
 {
     vm.TabProperty = ShowTabEditor(vm.TabProperty);
     vm.InvalidateTabProperty();
     vm.InvalidateCache();
 }
Пример #22
0
 public bool Contains(TabViewModel tabViewModel)
 {
     return this._tabItems.Contains(tabViewModel);
 }
Пример #23
0
 public void EditTab(TabViewModel vm)
 {
     vm.TabProperty = ShowTabEditor(vm.TabProperty);
     vm.InvalidateTabProperty();
     vm.InvalidateCache();
 }
Пример #24
0
 public bool Contains(TabViewModel tabViewModel)
 {
     return(this._tabItems.Contains(tabViewModel));
 }
Пример #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;
     }
 }
Пример #26
0
 protected void OnSelectedTabChanged(TabViewModel selected)
 {
     var stc = this.SelectedTabChanged;
     if (stc != null)
         stc(selected);
 }
Пример #27
0
 public TimelineListViewModel(TabViewModel parent, IEnumerable<IFilter> sources)
 {
     this.Parent = parent;
     this._timelineListCoreViewModel = new TimelineListCoreViewModel(parent, sources);
 }