public FavoriteViewModel() : base("お気に入り")
        {
            FavoriteList = new DispatcherCollection <TabItemViewModel>(DispatcherHelper.UIDispatcher);

            FavoriteList.Add(new FavoriteUserViewModel(this));
            FavoriteList.Add(new FavoriteCommunityViewModel(this));
        }
        public FavoriteViewModel()
            : base("フォロー")
        {
            FavoriteList = new DispatcherCollection<TabItemViewModel>(DispatcherHelper.UIDispatcher);

            FavoriteList.Add(new FavoriteUserViewModel(this));
            FavoriteList.Add(new FavoriteCommunityViewModel(this));
        }
        public GeneralViewModel()
        {
            _players = new DispatcherCollection<DisplayableItem<string>>(DispatcherHelper.UIDispatcher);
            _players.Add(new DisplayableItem<string>("mpc", "Media General Classic"));
            _screens = new DispatcherCollection<DisplayableItem<int>>(DispatcherHelper.UIDispatcher);
            var i = 1;
            foreach (Screen screen in Screen.AllScreens)
            {
                _screens.Add(new DisplayableItem<int>(i++, ScreenUtils.GetDisplayDevice(screen.DeviceName).DeviceString));
            }
            CurrentScreen = App.Config.ScreenNo;
            _monitorDirectories = new ObservableCollection<string>(App.Config.MonitorDirectories);


            var monitorDirectoriesListener = new CollectionChangedEventListener(_monitorDirectories)
            {
                (sender, args) =>
                {
                    App.Config.MonitorDirectories = _monitorDirectories;
                    App.Client.ResetLibraryUpdater();
                }
            };
            CompositeDisposable.Add(monitorDirectoriesListener);

        }
Exemple #4
0
        public FavoriteViewModel() : base("お気に入り")
        {
            FavoriteInstance = new NicoNicoFavorite();
            FavoriteList     = new DispatcherCollection <TabItemViewModel>(DispatcherHelper.UIDispatcher);

            FavoriteList.Add(new FavoriteUserViewModel(this, FavoriteInstance));
        }
        public FavoriteViewModel()
            : base("お気に入り")
        {
            FavoriteInstance = new NicoNicoFavorite();
            FavoriteList = new DispatcherCollection<TabItemViewModel>(DispatcherHelper.UIDispatcher);

            FavoriteList.Add(new FavoriteUserViewModel(this, FavoriteInstance));
        }
 public MylistListViewModel(MylistViewModel vm, NicoNicoMylistGroupData group, List <NicoNicoMylistData> list) : base(group.Name)
 {
     EditModeViewModel = new MylistEditModeViewModel(this);
     Owner             = vm;
     Group             = group;
     Mylist            = new DispatcherCollection <MylistListEntryViewModel>(DispatcherHelper.UIDispatcher);
     foreach (NicoNicoMylistData data in list)
     {
         Mylist.Add(new MylistListEntryViewModel(this, data));
     }
     Sort(0);
 }
Exemple #7
0
 /// <summary>
 /// 表示用ログリストにデータを追加
 /// </summary>
 /// <param name="rowData"></param>
 private void AddLogRowDataOnViewItems(List <LogRowData> rowDataList)
 {
     // 無理やりLINQ使ってみる
     rowDataList
     .Where(data => !_isSelected ? true : FilterNoEventLogDelegate(data))                      // 状態問い合わせとイベントなしの状態通知は表示しない
     .ToList().ForEach(rowData =>
     {
         var item = new ListViewConverter(rowData);
         item.LogBytesToString = _isHex ? (Func <byte[], string>)BytesToStringHex : BytesToStringAscii;
         _viewItems?.Add(item);
     });
 }
Exemple #8
0
        /// <summary>
        ///     ドキュメントペインにドキュメントを表示します
        /// </summary>
        public virtual IDocumentPaneViewModel ShowDocument(IDocumentPaneViewModel document)
        {
            var n = ContainsContent(document);

            if (n == null)
            {
                _Contents.Add(document);
                n = document;
            }

            this.ActivePane = n;
            return(n);
        }
        public MylistListViewModel(MylistViewModel vm, NicoNicoMylistGroupData group, List<NicoNicoMylistData> list)
            : base(group.Name)
        {
            EditModeViewModel = new MylistEditModeViewModel(this);
            Owner = vm;
            Group = group;
            Mylist = new DispatcherCollection<MylistListEntryViewModel>(DispatcherHelper.UIDispatcher);
            foreach(NicoNicoMylistData data in list) {

                Mylist.Add(new MylistListEntryViewModel(this, data));
            }
            Sort(SortIndex);
        }
Exemple #10
0
        public ResponseFileWriter(KanColleProxy proxy)
        {
            this.Log = new DispatcherCollection <string>(DispatcherHelper.UIDispatcher);

            //kcsとkcsapi以下を保存。キャッシュにある奴は保存されない。
            var kscSessionSource = proxy.SessionSource
                                   .Where(s => s.Request.PathAndQuery.StartsWith("/kcs/") ||
                                          s.Request.PathAndQuery.StartsWith("/kcsapi/"));

            kscSessionSource.Subscribe(s => s.SaveResponseBody(s.GetSaveFilePath()));

            kscSessionSource
            .Subscribe(s => Log.Add(DateTimeOffset.Now.ToString("HH:mm:ss : ") + s.Request.PathAndQuery));
        }
        public void Initialize()
        {
            IsActive = true;
            Owner.Status = "お気に入りユーザーを取得中";
            UserList = new DispatcherCollection<NicoNicoFavoriteUser>(DispatcherHelper.UIDispatcher);
            Task.Run(() => {
                foreach(var entry in FavoriteInstance.GetFavoriteUser()) {

                    UserList.Add(entry);
                }
                IsActive = false;
                Owner.Status = "";
            });
        }
Exemple #12
0
 public void Initialize()
 {
     IsActive     = true;
     Owner.Status = "お気に入りユーザーを取得中";
     UserList     = new DispatcherCollection <NicoNicoFavoriteUserContent>(DispatcherHelper.UIDispatcher);
     Task.Run(() => {
         foreach (var entry in FavoriteInstance.GetFavoriteUser())
         {
             UserList.Add(entry);
         }
         IsActive     = false;
         Owner.Status = "";
     });
 }
        public void Initialize()
        {
            Task.Run(() => {
                MylistData = PublicMylist.GetMylist();
                Name       = MylistData.MylistName;
                Mylist     = new DispatcherCollection <MylistListEntryViewModel>(DispatcherHelper.UIDispatcher);

                foreach (var entry in MylistData.Data)
                {
                    Mylist.Add(entry);
                }
                Sort(SortIndex);
            });
        }
        public void Initialize()
        {
            IsActive = true;
            Owner.Status = "フォローコミュニティを取得中";
            CommunityList = new DispatcherCollection<NicoNicoFavoriteCommunityContent>(DispatcherHelper.UIDispatcher);
            Task.Run(() => {
                foreach(var entry in FavoriteInstance.GetFavoriteCommunity()) {

                    CommunityList.Add(entry);
                }
                IsActive = false;
                Owner.Status = "";
            });
        }
Exemple #15
0
        public async void Initialize()
        {
            IsActive = true;
            Status   = "視聴履歴取得中";

            AccountHistoryList.Clear();
            var account = await HistoryInstance.GetAccountHistoryAsync();

            if (account != null)
            {
                foreach (var entry in account)
                {
                    AccountHistoryList.Add(new HistoryEntryViewModel(entry));
                }
            }

            var local = await HistoryInstance.GetLocalHistoryAsync();

            HistoryInstance.MergeHistories(account, local);

            local.Sort();
            local.Reverse();

            var collection = new DispatcherCollection <HistoryEntryViewModel>(DispatcherHelper.UIDispatcher);

            if (local != null)
            {
                foreach (var entry in local)
                {
                    collection.Add(new HistoryEntryViewModel(entry));
                }
                LocalHistoryList = collection;
            }
            HistoryInstance.SaveLocalHistory(local);

            IsActive = false;
        }
Exemple #16
0
        //設定ファイルの値からインスタンスを生成する
        private object GetNeedValue(string name, PropertyInfo property, object value)
        {
            switch(name) {
                case "FontFamily":
                    return new FontFamily((string)value);
                case "GridLength":
                    return new GridLengthConverter().ConvertFrom(value);
                case "Uri":
                    return new Uri((string)value);
                case "DispatcherCollection<NGCommentEntry>": {

                        var col = new DispatcherCollection<NGCommentEntry>(DispatcherHelper.UIDispatcher);

                        dynamic entries = (DynamicJson)value;

                        //NGフィルターのエントリを設定ファイルからパースする
                        foreach(var entry in entries) {

                            var ng = new NGCommentEntry();
                            ng.Type = Enum.Parse(typeof(NGType), entry.Type);
                            ng.Content = entry.Content;
                            ng.IsEnabled = entry.IsEnabled;

                            //NGフィルターの内容が更新されたら即セーブする
                            ng.PropertyChanged += ((sender, e) => Save());

                            col.Add(ng);
                        }

                        //新しくフィルターリストにエントリが追加/削除されたらセーブする
                        //追加だったら新しいエントリに即セーブするイベントを設定
                        col.CollectionChanged += ((sender, e) => {

                            if(e.Action == NotifyCollectionChangedAction.Add && e.NewItems.Count != 0 && e.NewItems[0] is NGCommentEntry) {

                                var ng = e.NewItems[0] as NGCommentEntry;
                                ng.PropertyChanged += ((sdr, ee) => Save());
                                Save();
                            } else {

                                Save();
                            }
                        });

                        return col;
                    }
                case "List<String>": {

                        var col = new List<string>();

                        dynamic entries = (DynamicJson)value;

                        //NGフィルターのエントリを設定ファイルからパースする
                        foreach(var entry in entries) {

                            col.Add(entry);
                        }
                        return col;
                    }

                default:
                    return value;
            }
        }
        public void Initialize()
        {
            Task.Run(() => {

                MylistData = PublicMylist.GetMylist();
                Name = MylistData.MylistName;
                Mylist = new DispatcherCollection<MylistListEntryViewModel>(DispatcherHelper.UIDispatcher);

                foreach(var entry in MylistData.Data) {

                    Mylist.Add(entry);
                }
                Sort(SortIndex);

            });
        }
Exemple #18
0
        //設定ファイルの値からインスタンスを生成する
        private object GetNeedValue(string name, PropertyInfo property, object value)
        {
            switch (name)
            {
            case "FontFamily":
                return(new FontFamily((string)value));

            case "GridLength":
                return(new GridLengthConverter().ConvertFrom(value));

            case "Uri":
                return(new Uri((string)value));

            case "DispatcherCollection<NGCommentEntry>": {
                var col = new DispatcherCollection <NGCommentEntry>(DispatcherHelper.UIDispatcher);

                dynamic entries = (DynamicJson)value;

                //NGフィルターのエントリを設定ファイルからパースする
                foreach (var entry in entries)
                {
                    var ng = new NGCommentEntry();
                    ng.Type      = Enum.Parse(typeof(NGType), entry.Type);
                    ng.Content   = entry.Content;
                    ng.IsEnabled = entry.IsEnabled;

                    //NGフィルターの内容が更新されたら即セーブする
                    ng.PropertyChanged += ((sender, e) => Save());

                    col.Add(ng);
                }

                //新しくフィルターリストにエントリが追加/削除されたらセーブする
                //追加だったら新しいエントリに即セーブするイベントを設定
                col.CollectionChanged += ((sender, e) => {
                        if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems.Count != 0 && e.NewItems[0] is NGCommentEntry)
                        {
                            var ng = e.NewItems[0] as NGCommentEntry;
                            ng.PropertyChanged += ((sdr, ee) => Save());
                            Save();
                        }
                        else
                        {
                            Save();
                        }
                    });

                return(col);
            }

            case "DispatcherCollection<String>": {
                var col = new DispatcherCollection <string>(DispatcherHelper.UIDispatcher);

                dynamic entries = (DynamicJson)value;

                //NGフィルターのエントリを設定ファイルからパースする
                foreach (var entry in entries)
                {
                    col.Add(entry);
                }
                //新しくフィルターリストにエントリが追加/削除されたらセーブする
                col.CollectionChanged += ((sender, e) => {
                        Save();
                    });
                return(col);
            }

            default:
                return(value);
            }
        }