當前位置: 首頁>>代碼示例>>C#>>正文


C# Label.QueueForReallocate方法代碼示例

本文整理匯總了C#中Xwt.Label.QueueForReallocate方法的典型用法代碼示例。如果您正苦於以下問題:C# Label.QueueForReallocate方法的具體用法?C# Label.QueueForReallocate怎麽用?C# Label.QueueForReallocate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Xwt.Label的用法示例。


在下文中一共展示了Label.QueueForReallocate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HudsTFWidget

        public HudsTFWidget(string title, string creator, string imgUrl, string hudstfUrl, string download, string website)
        {
            var downloadLower = download.ToLower();

            AddChild(ImageView = new ImageView() { WidthRequest = ImageSize.Width, HeightRequest = ImageSize.Height }, new Rectangle(1, 1, ImageSize.Width, ImageSize.Height));
            AddChild(titleLabel = new Label(title + " by " + creator) { TextColor = Colors.White }, new Rectangle(4, 0, ImageSize.Width, 40));

            titleLabel.Font = titleLabel.Font.WithScaledSize(1.5);
            titleLabel.WidthRequest = ImageSize.Width;
            titleLabel.HeightRequest = 40;
            titleLabel.QueueForReallocate();

            WidthRequest = ImageSize.Width + 2;
            HeightRequest = ImageSize.Height + 39;

            if (hudstfUrl != null)
            {
                hudstfButton = new ImageButton(57, 16, HudsTfLogo);
                hudstfButton.Click += (s, e) => { Desktop.OpenUrl(hudstfUrl); };

                AddChild(hudstfButton, ImageSize.Width - 64, ImageSize.Height + 11);
                //AddChild(hudstfButton, ImageSize.Width - 61, 24);
            }

            if (website != null)
            {
                websiteButton = new ImageButton(16, 16, QuadImageLinkButton.DefaultImage);
                websiteButton.Click += (s, e) => { Desktop.OpenUrl(website); };

                AddChild(websiteButton, ImageSize.Width - 84, ImageSize.Height + 11);
                //AddChild(websiteButton, ImageSize.Width - 81, 24);
            }

            bool hasDirectDownload = true;
            string zipLink = null;

            //string zipLink = download.Contains("github.com") || download.Contains("gitgud.net");
            if (downloadLower.Contains("github.com"))
                zipLink = download.TrimEnd('/') + "/archive/master.zip";
            else if (downloadLower.Contains("gitgud.net"))
                zipLink = download.TrimEnd('/') + "/repository/archive.zip";
            else
                hasDirectDownload = false;

            if (hasDirectDownload)
            {
                githubButton = new ImageButton(16, 16, GithubLogo);
                githubButton.Click += (s, e) => { Desktop.OpenUrl(download); };

                AddChild(githubButton, ImageSize.Width - 104, ImageSize.Height + 11);
            }

            dlButton = new Button();
            dlButton.Label = hasDirectDownload ? "Install" : "Get";
            dlButton.WidthRequest = 120;
            dlButton.HeightRequest = 24;
            //dlButton.Sensitive = downloadIsGithub;
            //https://gitgud.net/JediThug/jedihud/repository/archive.zip

            dlButton.Clicked += (s, e) =>
            {
                if (hasDirectDownload)
                {
                    DownloadHudWidget dl = new DownloadHudWidget("Fetching " + zipLink);

                    dl.DownloadFinished += (s2, e2) =>
                    {
                        try
                        {
                            if (!App.InstallZip(new MemoryStream(e2.Result), title))
                                MessageDialog.ShowError("Installing the Hud failed", "You can try to install it yourself.");
                        }
                        catch { }
                        Application.Invoke(() => { App.MainWindow.RemovePlugin(dl); });//App.MainWindow.Layout.RemoveChild(this));
                        Dispose();
                    };

                    dl.Download(zipLink);

                    App.MainWindow.Present();
                    System.Threading.Thread.Sleep(50);
                    App.MainWindow.Layout.AddChild(dl);
                }
                else
                {
                    Desktop.OpenUrl(download);
                }
            };

            AddChild(dlButton, 7, ImageSize.Height + 7);
            //AddChild(dlButton, 4, 20);

            Margin = new WidgetSpacing(4,4,4,4);

            //OnMouseExited(null);
        }
開發者ID:fourtf,項目名稱:4Plug,代碼行數:96,代碼來源:HudsTFDisplay.cs


注:本文中的Xwt.Label.QueueForReallocate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。