Beispiel #1
0
        private void BtnClick(object sender, EventArgs e)
        {
            ThumbnailButton thumbnail = sender as ThumbnailButton;

            thumbnail.StreamURL = StreamAPI.GetMediaURL(thumbnail.FileID, ConversationID);
            SwapToBtn(thumbnail);
        }
Beispiel #2
0
        public void AddMediaItem(String conversationID, String fileID, String fileName, int position, bool reachedRight = false)
        {
            Console.WriteLine("reached right: " + reachedRight);
            foreach (var uiElement in Gallery.Children)
            {
                if (!(uiElement is ThumbnailButton))
                {
                    continue;
                }
                ThumbnailButton btn = uiElement as ThumbnailButton;
                if (btn.FileID.Equals(fileID, StringComparison.OrdinalIgnoreCase))
                {
                    return;
                }
            }

            String thumbUrl  = StreamAPI.GetMediaThumbnailURL(fileID, conversationID);
            String streamUrl = StreamAPI.GetMediaURL(fileID, conversationID);

            MediaInfo media = new MediaInfo(thumbUrl, streamUrl, fileName, fileID);

            LoadThumbnail(media, int.MaxValue);

            IsReachedRight = reachedRight;
            borderRight    = Math.Min(position, borderRight);
        }
Beispiel #3
0
        public MediaInfo GetMediaInfo(string fileID, string fileName, string conversationID)
        {
            String thumbUrl  = StreamAPI.GetMediaThumbnailURL(fileID, conversationID);
            String streamUrl = StreamAPI.GetMediaURL(fileID, conversationID);

            MediaInfo media = new MediaInfo(thumbUrl, streamUrl, fileName, fileID);

            return(media);
        }
Beispiel #4
0
        public void Demo()
        {
            ThumbnailButton btn = new ThumbnailButton()
            {
                ThumbnailUrl = StreamAPI.GetMediaThumbnailURL("7ca94feb-4f57-4beb-8b6a-fe9225337794", "7516cdee-0971-472c-9a01-b2804dcedd9f"),
                StreamURL    = StreamAPI.GetMediaURL("7ca94feb-4f57-4beb-8b6a-fe9225337794", "7516cdee-0971-472c-9a01-b2804dcedd9f"),
                FileName     = "dreamstime_xxl_65780868_small.jpg",
                FileID       = "7ca94feb-4f57-4beb-8b6a-fe9225337794"
            };

            btn.Click += BtnClick;
            Gallery.Children.Add(btn);
        }
Beispiel #5
0
        public void AddMediaItemToFirst(String conversationID, String fileID, String fileName, int position, bool reachedLeft = true)
        {
            foreach (var uiElement in Gallery.Children)
            {
                if (!(uiElement is ThumbnailButton))
                {
                    continue;
                }
                ThumbnailButton btn = uiElement as ThumbnailButton;
                if (btn.FileID.Equals(fileID, StringComparison.OrdinalIgnoreCase))
                {
                    return;
                }
            }

            String thumbUrl  = StreamAPI.GetMediaThumbnailURL(fileID, conversationID);
            String streamUrl = StreamAPI.GetMediaURL(fileID, conversationID);

            MediaInfo media = new MediaInfo(thumbUrl, streamUrl, fileName, fileID);

            LoadThumbnail(media, 0);
        }
Beispiel #6
0
        public void Generate()
        {
            // header
            Output.WriteLine(
                "<p>This page contains the API documentation for this MPExtended service, as automatically generated on {0} for version {1} (build {2}). " +
                "Please do not edit, as your changes will be overwritten.</p>",
                DateTime.Now.ToString("dd MMM yyy HH:mm", System.Globalization.CultureInfo.InvariantCulture),
                VersionUtil.GetVersion(Assembly),
                VersionUtil.GetBuildVersion(Assembly));

            UserStream.WriteLine("Generating documentation for assembly {0}", Assembly.GetName().Name);

            // get all items
            IEnumerable <DocGenItem> typesToDocument = new List <DocGenItem>();

            if (JsonAPI != null)
            {
                typesToDocument = JsonAPI.GetMethods().Select(x => new DocGenItem()
                {
                    URLPrefix = "/json",
                    Reflected = x,
                    Name      = x.Name,
                    Order     = GenerateSortOrder(x.Name)
                });
            }
            if (StreamAPI != null)
            {
                typesToDocument = typesToDocument.Union(StreamAPI.GetMethods().Select(x => new DocGenItem()
                {
                    URLPrefix = "/stream",
                    Reflected = x,
                    Name      = x.Name,
                    Order     = GenerateSortOrder(x.Name)
                }));
            }
            if (Enumerations != null)
            {
                typesToDocument = typesToDocument.Union(Enumerations.Select(x => new DocGenItem()
                {
                    URLPrefix = "",
                    Reflected = x,
                    Name      = x.Name,
                    Order     = GenerateSortOrder(x.Name),
                }));
            }

            // sort all types
            typesToDocument = typesToDocument
                              .OrderBy(x => x.Order)
                              .ThenBy(x => x.Name);

            // print navigation
            int lastOrder = -1;

            UserStream.WriteLine("=> Generating documentation header");
            Output.WriteLine("<h3>Navigation</h3>");
            foreach (var item in typesToDocument)
            {
                if (lastOrder != item.Order)
                {
                    if (lastOrder != -1)
                    {
                        Output.WriteLine("</ul>");
                    }
                    Output.WriteLine("<h4>{0}</h4><ul>", GetHeadings()[item.Order]);
                    lastOrder = item.Order;
                }
                Output.WriteLine("<li><a href=\"#{0}\">{0}</a></li>", item.Name);
            }
            Output.WriteLine("</ul>");

            // generate all documentation
            lastOrder = -1;
            foreach (var item in typesToDocument)
            {
                if (lastOrder != item.Order)
                {
                    Output.WriteLine(String.Format("<h3>{0}</h3>", GetHeadings()[item.Order]));
                    lastOrder = item.Order;
                }

                if (item.Reflected is MethodInfo)
                {
                    GenerateMethodDocumentation(item.Reflected as MethodInfo, item.URLPrefix);
                }
                else if (item.Reflected is Type)
                {
                    GenerateEnumDocumentation(item.Reflected as Type);
                }
            }
            UserStream.WriteLine("=> Done");

            Output.Flush();
            Output.Close();
        }