public Model() { Children = new ObservableSynchronizedCollection <Item> { new Item() { Name = "AAA" }, new Item() { Name = "BBB", Children = new ObservableSynchronizedCollection <Item> { new Item() { Name = "B-1" }, new Item() { Name = "B-2" }, new Item() { Name = "B-3" }, } }, new Item() { Name = "CCC" }, }; }
public DirectMessageTimeline(Kbtter4Setting kb, string q, User p) { Setting = kb; DirectMessages = new ObservableSynchronizedCollection<DirectMessage>(); Query = new Kbtter3Query(q); Party = p; }
public ObservableSynchronizedCollection<FileMd5> check(String targetFolderPath) { var subFolders = System.IO.Directory.GetDirectories( targetFolderPath, "*", System.IO.SearchOption.AllDirectories); var ret = new ObservableSynchronizedCollection<FileMd5>(); //フォルダ下をチェック var infiles = System.IO.Directory.GetFiles( targetFolderPath, "*", System.IO.SearchOption.AllDirectories); foreach (var file in infiles) { ret.Add(MD5Sum(file)); } //サブフォルダ下をチェック foreach (var folder in subFolders) { var files = System.IO.Directory.GetFiles( folder, "*", System.IO.SearchOption.AllDirectories); foreach (var file in files) { ret.Add(MD5Sum(file)); } } return ret; }
private ComboRankPeriodModel() { _Items = new ObservableSynchronizedCollection <ComboboxItemModel> { new ComboboxItemModel() { Value = "hourly", Description = Resources.RANK_PERIOD_HOURLY }, new ComboboxItemModel() { Value = "daily", Description = Resources.RANK_PERIOD_DAILY }, new ComboboxItemModel() { Value = "weekly", Description = Resources.RANK_PERIOD_WEEKLY }, new ComboboxItemModel() { Value = "monthly", Description = Resources.RANK_PERIOD_MONTHLY }, new ComboboxItemModel() { Value = "total", Description = Resources.RANK_PERIOD_TOTAL }, }; }
//VideoInfoViewModel VideoInfo; /// <summary> /// デザイナ用引数なしコンストラクタ /// </summary> public SubscriptionHamburgerMenuViewModel() { model = new SubscriptionMenuModel(); //コントロールの初期化 Height = 580; //windowタイトルを除いた高さ Width = 900; SubScriptionMenuHeight = Height; SubScriptionMenuWidth = 280; VideoListPanelHeight = Height; VideoListPanelWidth = 700; VideoListPanelMargin = new Thickness(48, 0, 0, 0); IsPaneOpen = false; Items = new ObservableSynchronizedCollection <HamburgerMenuImageItem>(); VideoListItems = new ObservableSynchronizedCollection <VideoListItem>(); VideoListItems.Add(AddVideoItems("item1", @"C:\Users\03dai\source\repos\YoutubeLiveBrowser\YoutubeLiveBrowser\YoutubeLiveBrowser\bin\Debug\zui.jpg")); VideoListItems.Add(AddVideoItems("item1", @"C:\Users\03dai\source\repos\YoutubeLiveBrowser\YoutubeLiveBrowser\YoutubeLiveBrowser\bin\Debug\zui.jpg")); VideoInfo = new VideoInfoViewModel(); //for (int i = 0; i < 20;i++) //{ // VideoListItems2.Add(AddVideoItems()); // //VideoListItems.Add(AddTile()); //} }
/// <summary> /// 自分が登録しているチャンネルのチャンネルID /// </summary> private void GetSubscriptionNames() { var list = m_Controller.GetChannelNames(); Subscriptions = new ObservableSynchronizedCollection <string>(list); //todoチャンネル名の取得方法を変える SelectedChannelId = list.First(); }
public void check() { if (String.IsNullOrEmpty(sourceFolderPath) || String.IsNullOrEmpty(targetFolderPath)) { return; } sourceMD5List = check(this.sourceFolderPath); targetMD5List = check(this.targetFolderPath); if(sourceMD5List.Count >= targetMD5List.Count) { var tempTarget = targetMD5List; targetMD5List = sourceMD5List; sourceMD5List = tempTarget; } foreach (var sourceMD5item in sourceMD5List) { foreach (var targetMD5item in targetMD5List) { if (targetMD5item.MD5 == sourceMD5item.MD5) { targetMD5List.Remove(targetMD5item); break; } } } }
public StatusTimeline(Kbtter4Setting kb, string q) { Setting = kb; Statuses = new ObservableSynchronizedCollection<Status>(); HasQuery = true; Query = new Kbtter3Query(q); }
public WebBrowserControlViewModel(string inAPIKey) { Height = 1080; Width = 1900; //ChannelId = "UCD-miitqNY3nyukJ4Fnf4_A";//いいんちょ //ChannelId = "UC6oDys1BGgBsIC3WhG1BovQ";//しずりん //ChannelId = "UCv1fFr156jc65EMiLbaLImw";//rikiya //ChannelId = "UCsg-YqdqQ-KFF0LNk23BY4A";//でろ //ChannelId = "UC48jH1ul-6HOrcSSfoR02fQ";//リリ //ChannelId = "UCvmppcdYf4HOv-tFQhHHJMA";//もいもいUCNsidkYpIAQ4QaufptQBPHQ //ChannelId = "UCNsidkYpIAQ4QaufptQBPHQ"; //Comments = new ObservableSynchronizedCollection<string>(); string myChannelId = ConfigurationManager.AppSettings["MyChannelId"]; IsGetCommentEnable = false; m_Controller = new YoutubeLiveController(myChannelId, inAPIKey); Comments = new ObservableSynchronizedCollection <string>(); BindingOperations.EnableCollectionSynchronization(Comments, new object()); Action a = async() => { await GetYoutubeLiveStreamInfos(); GetSubscriptionNames(); }; a(); }
public SubscriptionHamburgerMenuViewModel(int MainwindowHeight, int MainwinndowWidth, DataBaseAccess inDataBaseAccess, YoutubeApiService inYoutubeApiService) : base(inDataBaseAccess, inYoutubeApiService) { model = new SubscriptionMenuModel(inDataBaseAccess, inYoutubeApiService);; //コントロールの初期化 Height = MainwindowHeight - 20; Width = MainwinndowWidth; SubScriptionMenuHeight = Height; SubScriptionMenuWidth = 280; VideoListPanelHeight = Height; VideoListPanelWidth = 700; VideoListPanelMargin = new Thickness(48, 0, 0, 0); IsPaneOpen = false; IsVideoListProgressActive = false; //MenuItemの生成 Items = new ObservableSynchronizedCollection <HamburgerMenuImageItem>(); BindingOperations.EnableCollectionSynchronization(Items, new object()); VideoListItems = new ObservableSynchronizedCollection <VideoListItem>(); BindingOperations.EnableCollectionSynchronization(VideoListItems, new object()); //動画情報のウィンドウ VideoInfo = new VideoInfoViewModel(); InitializeMenuItem(); VideoItem = new VideoItemViewModel(); }
public void Initialize() { Settings = UIAssistantAPI.Instance.UIAssistantSettings; Hotkeys = new ObservableSynchronizedCollection <Keybind>(Settings.Commands); Generator = UIAssistantAPI.Instance.CommandAPI.GetCommandGenerator(); Validator = UIAssistantAPI.Instance.CommandAPI.GetValidator(); }
public AttachTagItemPaneViewModel() { this.ContentId = "AttachTagItemPane"; this.Title = "タグ設定"; this._Items = new ObservableSynchronizedCollection <AttachTagListItem>(); ApplicationContext.Event.LoadedDeviceSetting += OnEvent_LoadedDeviceSetting; }
/// <summary> /// 絶対パス及び当クラスの親オブジェクトを指定して、当クラスのインスタンスを初期化します。 /// </summary> /// <param name="absolutePath">絶対パス</param> /// <param name="parent">当クラスの親オブジェクト</param> /// <remarks>存在しないファイルまたはディレクトリでも、インスタンスを生成できます。</remarks> public FileSystemModel(string absolutePath, FileSystemModel parent) { FullPath = absolutePath; Name = FileSystemService.GetName(absolutePath); Childs = new ObservableSynchronizedCollection <FileSystemModel>(); Parent = parent; }
public Kbtter4Account() { AccessToken = ""; AccessTokenSecret = ""; ScreenName = ""; Timelines = new ObservableSynchronizedCollection<Kbtter4SettingStatusTimelineData>(); Drafts = new ObservableSynchronizedCollection<Kbtter4Draft>(); UserId = 0; }
protected override void OnDisposed() { base.OnDisposed(); if (MenuItems != null) { MenuItems.Clear(); MenuItems = null; } }
protected override void OnDisposed() { base.OnDisposed(); if (Children != null) { Children.Clear(); Children = null; } }
public HomeTimeLine(IEnumerable <Tweeted> list, StreamingApi api) { List = new ObservableSynchronizedCollection <Tweeted>(list); /*api.UserAsObservable() * .Where(x => x.Type == MessageType.Create) * .Cast<StatusMessage>() * .Select(x => new Tweeted(x.Status)) * .Subscribe(x => List.Insert(0, x));*/ }
private SearchMylistModel() { // お気に入りリスト Favorites = new ObservableSynchronizedCollection <TFavorite>(); // マイリスト Mylists = Favorites.ToSyncedSynchronizationContextCollection( video => new SearchVideoByMylistModel(video.Mylist), AnonymousSynchronizationContext.Current ); }
public Kbtter4Setting() { Consumer = new Kbtter4SettingConsumer { Key = Kbtter4SettingConsumer.DefaultKey, Secret = Kbtter4SettingConsumer.DefaultSecret }; Accounts = new ObservableSynchronizedCollection<Kbtter4Account>(); Timelines = new Kbtter4SettingTimelines(); Searching = new Kbtter4SettingSearching(); ExternalService = new Kbtter4SettingExternalService(); Draft = new Kbtter4SettingDraft(); Miscellaneous = new Kbtter4SettingMiscellaneous(); }
public MylistStatusModel() { Favorites = new ObservableSynchronizedCollection <FavoriteModel>(); Disposed += (sender, e) => { // プロパティに設定された内容を外部ファイルに保存します。 JsonConverter.Serialize(Variables.MylistStatusPath, this); Mylists = null; Favorites = null; }; }
public ComposeWindowViewModel() { SettingsViewModel = new SettingsViewModel(); CompositeDisposable.Add(SettingsViewModel); Media = new ObservableSynchronizedCollection<UploadMediaInfoViewModel>(); CompositeDisposable.Add(new CollectionChangedEventListener(Media, (sender, e) => { RaisePropertyChanged(() => IsMediaAttached); RaisePropertyChanged(() => CharCountLeft); TweetCommand.RaiseCanExecuteChanged(); })); }
private ApplicationMessageService() { Messages = new ObservableSynchronizedCollection<ApplicationMessage>(); new CollectionChangedEventListener(Messages, (sender, e) => { var latest = Messages.LastOrDefault(); if (latest != LatestMessage) LatestMessage = latest; }); Messages.Add(new ApplicationMessage(ApplicationMessage.MessageType.Info, "MessageApplicationStart", null)); if (Settings.Current.Accounts.Count() == 0) Messages.Add(new ApplicationMessage(ApplicationMessage.MessageType.Warning, "MessageNoAccounts", "MessageNoAccountsDetail")); }
private ComboThumbSizeModel() { _Items = new ObservableSynchronizedCollection <ComboboxItemModel> { new ComboboxItemModel() { Value = "", Description = Resources.THUMB_SIZE_S }, new ComboboxItemModel() { Value = ".M", Description = Resources.THUMB_SIZE_M }, new ComboboxItemModel() { Value = ".L", Description = Resources.THUMB_SIZE_L }, }; }
public LandBase(Notifier notifier) { this.notifier = notifier; this.RelocatingSquadrons = new ObservableSynchronizedCollection <RelocatingSquadron>(); var proxy = KanColleClient.Current.Proxy; proxy.ApiSessionSource .Where(x => x.Request.PathAndQuery == "/kcsapi/api_get_member/mapinfo") .TryParse <kcsapi_mapinfo>() .Subscribe(x => this.Update(x.Data)); proxy.ApiSessionSource .Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/change_name") .TryParse() .Subscribe(this.ChangeName); proxy.ApiSessionSource .Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/set_action") .TryParse() .Subscribe(this.UpdateBehavior); proxy.ApiSessionSource .Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/supply") .TryParse() .Subscribe(this.Supply); proxy.ApiSessionSource .Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/set_plane") .TryParse <kcsapi_air_base>() .Subscribe(this.UpdateSquadrons); proxy.ApiSessionSource .SkipUntil(proxy.api_req_map_start.TryParse <kcsapi_map_start>().Do(x => this.Sortie(x.Data))) .TakeUntil(proxy.api_port) .Finally(this.Homing) .Repeat() .Subscribe(); #if DEBUG proxy.ApiSessionSource .Where(x => x.Request.PathAndQuery.StartsWith("/kcsapi/api_req_air_corps/")) .Subscribe(x => { string req = x.Request.BodyAsString; System.Diagnostics.Debug.WriteLine(Uri.UnescapeDataString(req)); }); #endif }
public MainWindowViewModel() { RadioChecks = new ObservableSynchronizedCollection<bool>() { true, false, false }; FileUris = new ObservableSynchronizedCollection<string>(); KernelSource = new double[7][] { new double[7], new double[7], new double[7], new double[7], new double[7], new double[7], new double[7] }; KernelSource = new double[][] { new double[]{ 0,0,0,0,0,0,0}, new double[]{ 0,0,0,0,0,0,0}, new double[]{ 0,0,1,0,-1,0,0}, new double[]{ 0,0,1,0,-1,0,0}, new double[]{ 0,0,1,0,-1,0,0}, new double[]{ 0,0,0,0,0,0,0}, new double[]{ 0,0,0,0,0,0,0} }; }
public void UpdateBasicCore(Model model, Point pos) { var items = model.Menu.MenuItem; ButtonsOrigin = new System.Windows.Point( -items.Max(x => Math.Abs(x.X)), -items.Max(x => Math.Abs(x.Y))); ButtonsContainerWidth = (-ButtonsOrigin.X * 2 + 1) * ConstValues.ButtonWidth; ButtonsContainerHeight = (-ButtonsOrigin.Y * 2 + 1) * ConstValues.ButtonHeight; Buttons = new ObservableSynchronizedCollection <MenuItemViewModel>( model.Menu.MenuItem.Select( x => new MenuItemViewModel(model, x, ButtonsOrigin)) .ToArray()); X = pos.X - ButtonsContainerWidth / 2; Y = pos.Y - ButtonsContainerHeight / 2; }
private ComboRankTargetModel() { _Items = new ObservableSynchronizedCollection <ComboboxItemModel> { new ComboboxItemModel() { Value = "fav", Description = Resources.RANK_TARGET_FAV }, new ComboboxItemModel() { Value = "view", Description = Resources.RANK_TARGET_VIEW }, new ComboboxItemModel() { Value = "res", Description = Resources.RANK_TARGET_RES }, new ComboboxItemModel() { Value = "mylist", Description = Resources.RANK_TARGET_MYLIST }, }; }
private void UpdateBasic(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { var model = sender as Model; if (model != null) { Title = model.Basic.Title; Buttons = new ObservableSynchronizedCollection <ButtonItemViewModel>( model.Basic.Buttons.Select( x => new ButtonItemViewModel(model, x)).ToArray()); ButtonsContainerHeight = Buttons.Max(x => x.Y) + ConstValues.ButtonHeight; ButtonsContainerWidth = Buttons.Max(x => x.X) + ConstValues.ButtonWidth; ButtonsAlignment = model.Basic.ButtonsAlignment; X = Math.Min(Math.Max(0, model.Basic.WindowLocation.X), SystemParameters.VirtualScreenWidth - Width); Y = Math.Min(Math.Max(0, model.Basic.WindowLocation.Y), SystemParameters.VirtualScreenHeight - Height); } }
public bool Load(string filename) { if (!File.Exists(filename)) return false; var itemList = new List<EnvItem>(); using (var reader = new StreamReader(filename)) { while (!reader.EndOfStream) { var items = reader.ReadLine().Split(','); if (items.Length != 2) continue; var key = items[0].Trim(); var value = items[1].Trim(); itemList.Add(new EnvItem() { Key = key, Value = value }); } } FilePath = filename; ItemList = new ObservableSynchronizedCollection<EnvItem>(itemList); return true; }
public void Initialize() { this.Cells = new ObservableSynchronizedCollection <CellModel>(); var rowIdx = 0; var items = this.Model.GetAllGridData2d(); foreach (var row in items) { var colIdx = 0; foreach (var item in row) { bool isVisible = true; if (item == -1 || item == -2) { isVisible = false; } bool isMine = false; if (item == -3) { isMine = true; } bool isFlag = false; if (item == -2) { isFlag = true; } int num = item; Cells.Add(new CellModel() { ColumnIndex = colIdx, RowIndex = rowIdx, IsMine = isMine, IsFlag = isFlag, IsVisible = isVisible, NumberAdjacentMines = num }); colIdx++; } rowIdx++; } }
public MainWindowViewModel() { RadioChecks = new ObservableSynchronizedCollection <bool>() { true, false, false }; FileUris = new ObservableSynchronizedCollection <string>(); KernelSource = new double[7][] { new double[7], new double[7], new double[7], new double[7], new double[7], new double[7], new double[7] }; KernelSource = new double[][] { new double[] { 0, 0, 0, 0, 0, 0, 0 }, new double[] { 0, 0, 0, 0, 0, 0, 0 }, new double[] { 0, 0, 1, 0, -1, 0, 0 }, new double[] { 0, 0, 1, 0, -1, 0, 0 }, new double[] { 0, 0, 1, 0, -1, 0, 0 }, new double[] { 0, 0, 0, 0, 0, 0, 0 }, new double[] { 0, 0, 0, 0, 0, 0, 0 } }; }
public StatusTimeline(Kbtter4Setting kb) { Setting = kb; Statuses = new ObservableSynchronizedCollection<Status>(); }
private SearchVideoByTemporaryModel() : base(true) { Videos = new ObservableSynchronizedCollection <VideoModel>(); }
public NotificationTimeline(Kbtter4Setting kb,string q) { Setting = kb; Notifications = new ObservableSynchronizedCollection<Kbtter4Notification>(); Query = new Kbtter3Query(q); }
private SortModel() { SortItems = new ObservableSynchronizedCollection <SortItemModel> { new SortItemModel() { Keyword = "-title", Description = "-title" }, new SortItemModel() { Keyword = "+title", Description = "+title" }, new SortItemModel() { Keyword = "-description", Description = "-description" }, new SortItemModel() { Keyword = "+description", Description = "+description" }, new SortItemModel() { Keyword = "-tags", Description = "-tags" }, new SortItemModel() { Keyword = "+tags", Description = "+tags" }, new SortItemModel() { Keyword = "-categoryTags", Description = "-categoryTags" }, new SortItemModel() { Keyword = "+categoryTags", Description = "+categoryTags" }, new SortItemModel() { Keyword = "-viewCounter", Description = "-viewCounter" }, new SortItemModel() { Keyword = "+viewCounter", Description = "+viewCounter" }, new SortItemModel() { Keyword = "-mylistCounter", Description = "-mylistCounter" }, new SortItemModel() { Keyword = "+mylistCounter", Description = "+mylistCounter" }, new SortItemModel() { Keyword = "-commentCounter", Description = "-commentCounter" }, new SortItemModel() { Keyword = "+commentCounter", Description = "+commentCounter" }, new SortItemModel() { Keyword = "-startTime", Description = "-startTime" }, new SortItemModel() { Keyword = "+startTime", Description = "+startTime" }, new SortItemModel() { Keyword = "-lastCommentTime", Description = "-lastCommentTime" }, new SortItemModel() { Keyword = "+lastCommentTime", Description = "+lastCommentTime" }, new SortItemModel() { Keyword = "-lengthSeconds", Description = "-lengthSeconds" }, new SortItemModel() { Keyword = "+lengthSeconds", Description = "+lengthSeconds" } }; SelectedItem = SortItems.First(); }
internal static ObservableSynchronizedCollection<MediaSegment> DbMediaSegmentsRead(this PersistentMedia media) { if (Connect()) { Guid mediaGuid = media.MediaGuid; ObservableSynchronizedCollection<MediaSegment> segments = null; MediaSegment newMediaSegment; MySqlCommand cmd = new MySqlCommand("SELECT * FROM tas.MediaSegments where MediaGuid = @MediaGuid;", connection); cmd.Parameters.Add("@MediaGuid", MySqlDbType.Binary).Value = mediaGuid.ToByteArray(); lock (connection) { if (_mediaSegments == null) _mediaSegments = new Hashtable(); segments = (ObservableSynchronizedCollection<MediaSegment>)_mediaSegments[mediaGuid]; if (segments == null) { segments = new ObservableSynchronizedCollection<MediaSegment>(); using (MySqlDataReader dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { newMediaSegment = new MediaSegment(mediaGuid) { idMediaSegment = dataReader.GetUInt64("idMediaSegment"), SegmentName = (dataReader.IsDBNull(dataReader.GetOrdinal("SegmentName")) ? string.Empty : dataReader.GetString("SegmentName")), TCIn = dataReader.IsDBNull(dataReader.GetOrdinal("TCIn")) ? default(TimeSpan) : dataReader.GetTimeSpan("TCIn"), TCOut = dataReader.IsDBNull(dataReader.GetOrdinal("TCOut")) ? default(TimeSpan) : dataReader.GetTimeSpan("TCOut"), }; segments.Add(newMediaSegment); } dataReader.Close(); } _mediaSegments.Add(mediaGuid, segments); } } return segments; } else return null; }
public Category() { ChildCategories = new ObservableSynchronizedCollection <Category>(); Labels = new ObservableSynchronizedCollection <Label>(); }
public SearchVideoByRankingModel() : base(false) { Videos = new ObservableSynchronizedCollection <VideoModel>(); }
private void AnalyzeTextElements() { TextElements = new ObservableSynchronizedCollection<StatusTextElement>(); var l = new List<Tuple<int[], StatusTextElement>>(); if (Source.Entities != null) { if (Source.Entities.Urls != null) foreach (var i in Source.Entities.Urls) { //Text = Text.Replace(i.Url.ToString(), i.DisplayUrl.ToString()); var e = new StatusTextElement(); e.Original = i.Url.ToString(); e.Action = main.View.OpenInDefault; e.Type = StatusTextElementType.Uri; e.Link = i.ExpandedUrl; e.Surface = i.DisplayUrl; l.Add(new Tuple<int[], StatusTextElement>(i.Indices, e)); } /* //互換性上の理由で画像がUrlとMedia両方で送られてくるらしいので暫定的に削除 if (Source.Entities.Media != null) foreach (var i in Source.Entities.Media) { //Text = Text.Replace(i.Url.ToString(), i.DisplayUrl.ToString()); var e = new StatusTextElement(); e.Original = i.Url.ToString(); e.Action = main.View.OpenInDefault; e.Type = StatusTextElementType.Media; e.Link = i.ExpandedUrl; e.Surface = i.DisplayUrl; l.Add(new Tuple<int[], StatusTextElement>(i.Indices, e)); } */ if (Source.Entities.UserMentions != null) foreach (var i in Source.Entities.UserMentions) { var e = new StatusTextElement(); e.Action = async (p) => { var user = await Kbtter.Token.Users.ShowAsync(id => i.Id); Kbtter.AddUserToUsersList(user); main.View.Notify(user.Name + "さんの情報"); main.View.ChangeToUser(); }; e.Type = StatusTextElementType.User; e.Link = new Uri("https://twitter.com/" + i.ScreenName); e.Surface = "@" + i.ScreenName; e.Original = e.Surface; l.Add(new Tuple<int[], StatusTextElement>(i.Indices, e)); } if (Source.Entities.HashTags != null) foreach (var i in Source.Entities.HashTags) { var e = new StatusTextElement(); e.Action = (p) => { main.View.ChangeToSearch(); main.View.SearchText = "#" + i.Text; Kbtter.Search("#" + i.Text); }; e.Type = StatusTextElementType.Hashtag; e.Link = new Uri("https://twitter.com/search?q=%23" + i.Text); e.Surface = "#" + i.Text; e.Original = e.Surface; l.Add(new Tuple<int[], StatusTextElement>(i.Indices, e)); } l.Sort((x, y) => x.Item1[0].CompareTo(y.Item1[0])); } int le = 0; foreach (var i in l) { var el = i.Item1[1] - i.Item1[0]; var ntl = i.Item1[0] - le; if (ntl != 0) { var nt = Text.Substring(le, ntl); nt = nt .Replace("<", "<") .Replace(">", ">") .Replace("&", "&"); TextElements.Add(new StatusTextElement { Surface = nt, Type = StatusTextElementType.None }); } TextElements.Add(i.Item2); le = i.Item1[1]; } //foreach (var i in l) Text = Text.Replace(i.Item2.Original, i.Item2.Surface); if (Text.Length > le - 1) { var ls = Text.Substring(le); ls = ls .Replace("<", "<") .Replace(">", ">") .Replace("&", "&"); TextElements.Add(new StatusTextElement { Surface = ls, Type = StatusTextElementType.None }); } }
public void Initialize() { _timerValueListModel = TimerListFactory.Create(); EditTimerValueStrList = new ObservableSynchronizedCollection<string> { }; _editTimerValueList = _timerValueListModel.getEditTimerValueList(); foreach (TimeSpan value in _editTimerValueList) { EditTimerValueStrList.Add(MyUtil.TimeSpanTo24hStr(value)); } }
private ComboRankTargetModel() { _Items = new ObservableSynchronizedCollection <ComboboxItemModel> { new ComboboxItemModel() { Value = "all", Description = "全ジャンル" }, new ComboboxItemModel() { Value = "hot_topic", Description = "話題" }, new ComboboxItemModel() { Value = "entertainment", Description = "エンターテイメント" }, new ComboboxItemModel() { Value = "radio", Description = "ラジオ" }, new ComboboxItemModel() { Value = "music_sound", Description = "音楽・サウンド" }, new ComboboxItemModel() { Value = "dance", Description = "ダンス" }, new ComboboxItemModel() { Value = "animal", Description = "動物" }, new ComboboxItemModel() { Value = "nature", Description = "自然" }, new ComboboxItemModel() { Value = "cooking", Description = "料理" }, new ComboboxItemModel() { Value = "traveling_outdoor", Description = "旅行・アウトドア" }, new ComboboxItemModel() { Value = "vehicle", Description = "乗り物" }, new ComboboxItemModel() { Value = "sports", Description = "スポーツ" }, new ComboboxItemModel() { Value = "society_politics_news", Description = "社会・政治・時事" }, new ComboboxItemModel() { Value = "technology_craft", Description = "技術・工作" }, new ComboboxItemModel() { Value = "commentary_lecture", Description = "解説・講座" }, new ComboboxItemModel() { Value = "anime", Description = "アニメ" }, new ComboboxItemModel() { Value = "game", Description = "ゲーム" }, new ComboboxItemModel() { Value = "other", Description = "その他" }, new ComboboxItemModel() { Value = "r18", Description = "R-18" }, }; }
public MainWindowViewModel() { View = new MainWindowViewViewModel(); Medias = new ObservableSynchronizedCollection<MainWindowSendingMediaViewModel>(); }
public void ToReadOnlyTest() { var src = new ObservableSynchronizedCollection <string>(); }
public bool Load(string filename) { if (!File.Exists(filename)) return false; var setList = new List<EnvItemSet>(); using (var reader = new StreamReader(filename)) { while (!reader.EndOfStream) { var listfile = reader.ReadLine().Trim(); if (!File.Exists(listfile)) continue; var set = new EnvItemSet(); if (!set.Load(listfile)) continue; setList.Add(set); } } FilePath = filename; SetList = new ObservableSynchronizedCollection<EnvItemSet>(setList); CurrentSetIndex = 0; return true; }
public JsonCollection() { this.Data = new ObservableSynchronizedCollection<string>(); }
/// <summary> /// 指定された検索ワードで一覧を再読み込みします。 /// </summary> public override void Reload() { var url = GetMylistUrl(Word); if (url == null) { ServiceFactory.MessageService.ShowError("IDが正しくありません。"); return; } var txt = GetSmileVideoHtmlText(url); if (IsError(txt)) { return; } if (url == HttpRequestConst.MylistDefault) { MylistTitle = "Toriaezu Mylist"; var result = DynamicJson.Parse(txt); // 自分のリストを検索した。 ServiceFactory.MessageService.ShowError(result["status"]); foreach (dynamic item in result["mylistitem"]) { if (item["item_type"] != "0") { continue; } var model = new VideoModel() { Title = item["title"], ContentId = item["video_id"], ViewCounter = item["view_counter"], MylistCounter = item["mylist_counter"], StartTime = DateTime.Parse(item["update_time"]), LengthSeconds = item["length_seconds"] }; Items.Add(model); // // //num_res // //first_retrieve // //item_id //description } } else { // 他人のリストを検索した。 var result = XDocument.Load(new StringReader(txt)).Root; var channel = result.Descendants("channel").First(); MylistTitle = channel.Element("title").Value; MylistCreator = channel.Element(XName.Get("creator", "http://purl.org/dc/elements/1.1/")).Value; MylistDate = DateTime.Parse(channel.Element("lastBuildDate").Value); // TODO descriptionにもうちょっとあるらしい Items = new ObservableSynchronizedCollection <VideoModel>( channel.Descendants("item").Select( item => new VideoModel() { Title = item.Element("title").Value, ContentId = item.Element("link").Value, StartTime = DateTime.Parse(channel.Element("pubDate").Value) } ) ); } ServiceFactory.MessageService.ShowError("owatta2"); }
public Label() { ChildLabels = new ObservableSynchronizedCollection <Label>(); Contents = new ObservableSynchronizedCollection <Content>(); Categories = new ObservableSynchronizedCollection <Category>(); }
public StatusViewModel(MainWindowViewModel mw, Status st) { Kbtter = Kbtter.Instance; main = mw; AdditionalMenus = ViewModelHelper.CreateReadOnlyDispatcherCollection( Kbtter.StatusMenus, p => new StatusAdditionalMenuViewModel(p, st), DispatcherHelper.UIDispatcher); RegisterEventListeners(); SourceStatus = st; ReceivedStatus = SourceStatus; if (SourceStatus.RetweetedStatus != null) { SourceStatus = SourceStatus.RetweetedStatus; IsRetweet = true; RetweetingUser = new UserViewModel(ReceivedStatus.User, main); } _IsFavorited = Kbtter.CheckFavorited(SourceStatus.Id); RaisePropertyChanged(() => IsFavorited); _IsRetweeted = Kbtter.CheckRetweeted(SourceStatus.Id); RaisePropertyChanged(() => IsRetweeted); _CreatedTimeText = SourceStatus.CreatedAt.LocalDateTime; RaisePropertyChanged(() => CreatedTimeText); User = new UserViewModel(SourceStatus.User, main); Text = SourceStatus.Text; OnelineText = Text .Replace("\r", " ") .Replace("\n", " "); FavoriteCount = SourceStatus.FavoriteCount ?? 0; RetweetCount = SourceStatus.RetweetCount ?? 0; IsMyStatus = SourceStatus.User.Id == Kbtter.AuthenticatedUser.Id; IsRetweetable = !IsMyStatus && !SourceStatus.User.IsProtected; if (SourceStatus.Entities.UserMentions != null) { IsReplyToMe = SourceStatus.Entities.UserMentions.Any(p => p.Id == Kbtter.AuthenticatedUser.Id); } ExtractVia(); AnalyzeTextElements(); DispatcherHelper.UIDispatcher.BeginInvoke((Action)(() => { if (SourceStatus.Entities != null) { Medias = new ObservableSynchronizedCollection<StatusMediaViewModel>(); if (SourceStatus.Entities.Urls != null) { var r = Kbtter4ExtraMediaUriConverter.TryGetDirectUri(SourceStatus.Entities.Urls.Select(p => p.ExpandedUrl)); foreach (var i in r) Medias.Add(new StatusMediaViewModel { Uri = i }); } if (SourceStatus.Entities.Media != null) { foreach (var i in SourceStatus.Entities.Media) { Medias.Add(new StatusMediaViewModel { Uri = i.MediaUrlHttps }); } } HasMedia = Medias.Count != 0; } })); }
protected override void Dispose(bool disposing) { Hotkeys = null; base.Dispose(disposing); }