Inheritance: Windows.UI.Xaml.Controls.UserControl
Beispiel #1
0
        protected override void OnApplyTemplate()
        {

            if (_cvMain == null) {
                _cvMain = GetTemplateChild("cvMain") as ContentView;
                _cvMain.SendMessage += _cvMain_SendMessage;
            }
            
            if (_prLoading == null)
            {
                _prLoading = GetTemplateChild("prLoading") as ProgressRing;
            }

            if (_tbSearchUrl  == null)
            {
                _tbSearchUrl = GetTemplateChild("tbSearchUrl") as TextBox;
                _tbSearchUrl.KeyUp += _tbSearchUrl_KeyUp;
            }

            if (_tbText == null)
            {
                _tbText = GetTemplateChild("tbText") as TextBlock;
            }

            if (_butAddTab == null)
            {
                _butAddTab = GetTemplateChild("butAddTab") as Button;
            }
            


            base.OnApplyTemplate();
        }
Beispiel #2
0
        private static void UriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {

            if (!e.NewValue.Equals(e.OldValue)) {

                if (_cv != null) {
                    if (_cv.Renderer != null) {
                        _cv.layoutRoot.Children.Remove(_cv.Renderer.RenderElement);
                        _cv.Renderer.Unload();
                        _cv.Renderer.SendMessage -= Renderer_SendMessage;
                        _cv.Renderer = null;
                    }
                    _cv.layoutRoot.Children.Clear();
                }

                 ContentView cv = (ContentView)d;
                
                if (cv.Renderer != null ) {
                    cv.layoutRoot.Children.Remove(cv.Renderer.RenderElement);
                    cv.layoutRoot.Children.Clear();
                    cv.Renderer.Unload();
                    cv.Renderer.SendMessage -= Renderer_SendMessage;
                    cv.Renderer = null;
                }

                if (string.IsNullOrEmpty((string)e.NewValue)) return;

                var uriNew = (string)e.NewValue;
                
                if (uriNew.Contains(".mp4") || uriNew.Contains(".mpeg") || uriNew.Contains(".avi") 
                    || uriNew.Contains(".webm") || uriNew.Contains(".ogv") || uriNew.Contains(".3gp") 
                    || uriNew.Contains(".mkv"))
                    cv.Renderer = new FFmpeg.FFmpegRenderer(); 
                else if (uriNew.Contains(".tile")) cv.Renderer = new Tiles.TileRenderer();
                else if (uriNew.Contains(".dotnet")) cv.Renderer = new DotnetCLI.DotnetCLIRenderer();
                else if (uriNew.Contains(".map")) cv.Renderer = new MapView.MapViewRenderer();
                else if (uriNew.Contains(".sketch")) cv.Renderer = new SketchFlow.SketchFlowRenderer();
                else if (uriNew.Contains(".urho")) cv.Renderer = new UrhoSharp.UrhoRenderer();
                else if (uriNew.Contains(".flickr")) cv.Renderer = new Flickr.FlickrRenderer();
                else if (uriNew.Contains(".twitter")) cv.Renderer = new Twitter.TwitterRenderer();
                else if (uriNew.Contains(".comp")) cv.Renderer = new WinComposition.DirectCompositionRenderer();
                else cv.Renderer = new WebViewRenderer();
                
                cv.Renderer.SendMessage += Renderer_SendMessage;
                cv.Renderer.Load();
                cv.layoutRoot.Children.Add(cv.Renderer.RenderElement);
                cv.Renderer.UpdateSource(uriNew);

                _cv = cv;

            }
            
        }