protected override void OnApplyTemplate() { Question = GetTemplateChild(nameof(Question)) as TextBlock; Type = GetTemplateChild(nameof(Type)) as TextBlock; RecentVoters = GetTemplateChild(nameof(RecentVoters)) as RecentUserHeads; TimeoutLabel = GetTemplateChild(nameof(TimeoutLabel)) as StackPanel; Timeout = GetTemplateChild(nameof(Timeout)) as TextBlock; TimeoutGlyph = GetTemplateChild(nameof(TimeoutGlyph)) as TextBlock; Explanation = GetTemplateChild(nameof(Explanation)) as GlyphButton; Options = GetTemplateChild(nameof(Options)) as StackPanel; Votes = GetTemplateChild(nameof(Votes)) as TextBlock; Submit = GetTemplateChild(nameof(Submit)) as Button; View = GetTemplateChild(nameof(View)) as Button; RecentVoters.RecentUserHeadChanged += RecentVoters_RecentUserHeadChanged; Explanation.Click += Explanation_Click; Submit.Click += Submit_Click; View.Click += View_Click; _templateApplied = true; if (_message != null) { UpdateMessage(_message); } }
private void EnableDisableAccept(bool enabled) { GlyphButton accept = View.FindByName <GlyphButton>("AcceptButton"); if (accept != null) { accept.IsEnabled = enabled; } }
public void renderGlyphs(List <int> currentGlyphIdSequence) { for (int i = 0; i < currentGlyphIdSequence.Count; i++) { int id = currentGlyphIdSequence[i]; GlyphButton gb = S.Array.Find(buttons, g => g.glyphId == id); symbols[i].enabled = true; Image img = symbols[i]; img.sprite = gb.generic; } }
public IAsyncOperation <ContentDialogBaseResult> ShowAsync(TLWebPage webPage) { if (ApplicationView.GetForCurrentView().IsCompactOverlaySupported()) { return(AsyncInfo.Run(async token => { var w = webPage.EmbedWidth ?? 340; var h = webPage.EmbedHeight ?? 200; double ratioX = (double)340 / w; double ratioY = (double)340 / h; double ratio = Math.Min(ratioX, ratioY); var preferences = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay); preferences.CustomSize = new Size(w * ratio, h * ratio); var newView = CoreApplication.CreateNewView(); var newViewId = 0; await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var request = new HttpRequestMessage(HttpMethod.Get, new Uri(webPage.EmbedUrl)); request.Headers.Referer = new Uri("https://youtube.com"); var view = new WebView(); view.NavigateWithHttpRequestMessage(request); //view.Navigate(new Uri(webPage.EmbedUrl)); var yolo = new GlyphButton(); yolo.HorizontalAlignment = HorizontalAlignment.Right; yolo.VerticalAlignment = VerticalAlignment.Bottom; yolo.Glyph = "\uE740"; yolo.Click += async(s, args) => { var current = ApplicationView.GetForCurrentView(); if (current.ViewMode == ApplicationViewMode.CompactOverlay) { current.TryEnterFullScreenMode(); } else { await current.TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay, preferences); } }; var ciccio = new Grid(); ciccio.RequestedTheme = ElementTheme.Dark; ciccio.Children.Add(view); ciccio.Children.Add(yolo); Window.Current.Content = ciccio; Window.Current.Activate(); Window.Current.VisibilityChanged += (s, args) => { if (args.Visible) { return; } view.NavigateToString(string.Empty); }; newViewId = ApplicationView.GetForCurrentView().Id; var coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; var titleBar = ApplicationView.GetForCurrentView().TitleBar; titleBar.ButtonBackgroundColor = Colors.Transparent; titleBar.ButtonForegroundColor = Colors.White; titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; titleBar.ButtonInactiveForegroundColor = Colors.White; }); var viewShown = await ApplicationViewSwitcher.TryShowAsViewModeAsync(newViewId, ApplicationViewMode.CompactOverlay, preferences); return ContentDialogBaseResult.OK; })); } else { if (webPage.HasEmbedUrl) { Image.Constraint = webPage; View.Navigate(new Uri(webPage.EmbedUrl)); } return(base.ShowAsync()); } }