Exemple #1
0
        public async void Initialize()
        {
            IsActive = true;

            ApiData = await WatchiApiInstance.GetWatchApiDataAsync();

            if (ApiData == null)
            {
                return;
            }

            Name = ApiData.Video.Title;

            //タグ情報を初期化して追加
            TagList.Clear();
            foreach (var tag in ApiData.Tags)
            {
                TagList.Add(new VideoTagViewModel(tag, this));
            }

            IsActive = false;
            //コメントを取得
            Comment = new VideoCommentViewModel(this);

            Mylist = new VideoMylistViewModel(this);


            if (IsFullScreen)
            {
                FullScreenController = new Views.VideoController()
                {
                    DataContext = this
                };
                FullScreenWebBrowser           = new WebBrowser();
                FullScreenWebBrowser.Focusable = false;

                Handler?.Dispose();
                Handler = new VideoHtml5Handler(FullScreenWebBrowser);
                Handler.Initialize(this);
            }
            else
            {
                Controller = new Views.VideoController()
                {
                    DataContext = this
                };
                WebBrowser           = new WebBrowser();
                WebBrowser.Focusable = false;

                Handler?.Dispose();
                Handler = new VideoHtml5Handler(WebBrowser);
                Handler.Initialize(this);
            }

            await Comment.Initialize();

            //画像処理をUIスレッドでやられると重いので
            await Task.Run(async() => StoryBoardList = await StoryBoardInstance.GetVideoStoryBoardAsync(ApiData.Video.SmileInfo.Url));
        }
 ///--------------------------------------------------------------------------------
 /// <summary>This method disposes of resources in the model.</summary>
 ///--------------------------------------------------------------------------------
 protected override void OnDispose()
 {
     if (_tagList != null)
     {
         foreach (Tag tag in TagList)
         {
             tag.Dispose();
         }
         TagList.Clear();
         TagList = null;
     }
 }
Exemple #3
0
        public void GetTagsFromDB()
        {
            if (TagList == null)
            {
                TagList = new List <TagState> (0);
            }
            else
            {
                TagList.Clear();
            }

            var allTag = new TagState();

            allTag.Title      = "All Tags";
            allTag.Color      = string.Empty;
            allTag.CheckState = NSCellStateValue.On;
            TagList.Add(allTag);

            var noTag = new TagState();

            noTag.Title      = "No Tag";
            noTag.Color      = string.Empty;
            noTag.CheckState = NSCellStateValue.Off;
            TagList.Add(noTag);

            var separatorTag = new TagState();

            separatorTag.Title      = "Seperator";
            separatorTag.Color      = string.Empty;
            separatorTag.CheckState = NSCellStateValue.Off;
            TagList.Add(separatorTag);

            if (AnnCategoryTagUtil.Instance == null)
            {
                return;
            }

            var tagList = AnnCategoryTagUtil.Instance.GetTags();

            foreach (var item in tagList)
            {
                var tagState = new TagState();
                tagState.Title      = item.Title;
                tagState.Color      = item.Color;
                tagState.TagID      = item.TagId;
                tagState.CheckState = NSCellStateValue.Off;
                TagList.Add(tagState);
            }
        }
Exemple #4
0
        public void LoadResults()
        {
            if (!Directory.Exists("savedResults"))
            {
                return;
            }
            var tags = Directory.EnumerateDirectories("savedResults").Select(x => x.Split(Path.DirectorySeparatorChar).Last()).ToList();

            lock (_resultLock)
            {
                TagList.Clear();
                tags.ForEach(x => TagList.Add(new Tag {
                    Label = x
                }));
            }
        }
Exemple #5
0
        /// <summary>
        /// Disposes all tags in the pool and prepares the pool for garbage collection.
        /// </summary>
        public void Dispose()
        {
            foreach (Tag tag in globals.Values)
            {
                tag.ReferenceCount--;
            }

            lock (typeof(Tag)) // this needs to be done to prevent some nasty effects should another thread attempt to try something with a tag while they are being disposed.
            {
                Tag.NotReferencedCanFire = false;
                foreach (Tag tag in tags)
                {
                    if (tag.PostProcessed)
                    {
                        tag.Dispose();
                    }
                }
                foreach (Tag tag in tags)
                {
                    if (tag.ReferenceCount != 0)
                    {
                        Output.Write(OutputTypes.Warning, "Pool: Tag {0} of type {1} was globally disposed with a reference count of {2}.", tag.Name, tag.GetType().Name, tag.ReferenceCount);
                    }
                }
                tags.Clear();
                Tag.NotReferencedCanFire = true;
            }

            archives.Clear();
            prefabs.Clear();
            shareds.Clear();
            globals.Clear();

            format  = null;
            library = null;
        }
Exemple #6
0
        public static TagList ParseList(JsonReader reader, string rootName)
        {
            TagList list = new TagList(rootName);
            bool foundGeneric = false;
            while (reader.Read())
            {
                if (reader.TokenType == JsonToken.Boolean)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric = true;
                        list.GenericType = ETagType.Byte;
                    }

                    bool b = (bool)reader.Value;
                    TagByte tag = new TagByte(null, b);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.Integer)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric = true;
                        list.GenericType = ETagType.Long;
                    }

                    long l = (long)reader.Value;
                    TagLong tag = new TagLong(null, l);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.Float)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric = true;
                        list.GenericType = ETagType.Float;
                    }
                    else if (list.GenericType == ETagType.Long)
                    {
                        List<TagDouble> buf = new List<TagDouble>();
                        foreach (TagLong tl in list)
                        {
                            buf.Add(new TagDouble(tl.Name, tl.Value));
                        }
                        list.Clear();
                        list.GenericType = ETagType.Double;
                        foreach (TagDouble td in buf)
                        {
                            list.Add(td);
                        }
                    }

                    double d = (double)reader.Value;
                    TagDouble tag = new TagDouble(null, d);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.String)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric = true;
                        list.GenericType = ETagType.String;
                    }

                    string s = reader.Value as string;
                    TagString tag = new TagString(null, s);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.StartObject)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric = true;
                        list.GenericType = ETagType.Compound;
                    }

                    TagCompound tag = ParseCompound(reader, null);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.StartArray)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric = true;
                        list.GenericType = ETagType.List;
                    }

                    TagList inner = ParseList(reader, null);
                    list.Add(inner);
                }
                else if (reader.TokenType == JsonToken.EndArray)
                {
                    return list;
                }
                else
                {
                    throw new NotImplementedException("Currently no handling for this type of JSON token: " + reader.TokenType.ToString());
                }
            }

            return list;
        }
Exemple #7
0
        public static TagList ParseList(JsonReader reader, string rootName)
        {
            TagList list         = new TagList(rootName);
            bool    foundGeneric = false;

            while (reader.Read())
            {
                if (reader.TokenType == JsonToken.Boolean)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric     = true;
                        list.GenericType = ETagType.Byte;
                    }

                    bool    b   = (bool)reader.Value;
                    TagByte tag = new TagByte(null, b);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.Integer)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric     = true;
                        list.GenericType = ETagType.Long;
                    }

                    long    l   = (long)reader.Value;
                    TagLong tag = new TagLong(null, l);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.Float)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric     = true;
                        list.GenericType = ETagType.Float;
                    }
                    else if (list.GenericType == ETagType.Long)
                    {
                        List <TagDouble> buf = new List <TagDouble>();
                        foreach (TagLong tl in list)
                        {
                            buf.Add(new TagDouble(tl.Name, tl.Value));
                        }
                        list.Clear();
                        list.GenericType = ETagType.Double;
                        foreach (TagDouble td in buf)
                        {
                            list.Add(td);
                        }
                    }

                    double    d   = (double)reader.Value;
                    TagDouble tag = new TagDouble(null, d);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.String)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric     = true;
                        list.GenericType = ETagType.String;
                    }

                    string    s   = reader.Value as string;
                    TagString tag = new TagString(null, s);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.StartObject)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric     = true;
                        list.GenericType = ETagType.Compound;
                    }

                    TagCompound tag = ParseCompound(reader, null);
                    list.Add(tag);
                }
                else if (reader.TokenType == JsonToken.StartArray)
                {
                    if (!foundGeneric)
                    {
                        foundGeneric     = true;
                        list.GenericType = ETagType.List;
                    }

                    TagList inner = ParseList(reader, null);
                    list.Add(inner);
                }
                else if (reader.TokenType == JsonToken.EndArray)
                {
                    return(list);
                }
                else
                {
                    throw new NotImplementedException("Currently no handling for this type of JSON token: " + reader.TokenType.ToString());
                }
            }

            return(list);
        }
Exemple #8
0
 public void ClearTags()
 {
     tagList_.Clear();
 }