예제 #1
0
        public TradingViewControl()
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
            InitializeComponent();
            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                try
                {
                    var splashPictureBox = new PictureBox();
                    Controls.Add(splashPictureBox);
                    splashPictureBox.Dock     = DockStyle.Fill;
                    splashPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    splashPictureBox.Load("https://raw.githubusercontent.com/ExtremeDotneting/UndergroundIRO.TradingViewKit/master/data/splash.jpg");
                    splashPictureBox.Invalidate();
                }
                catch { }
                return;
            }
            var control = new CefSharpXWebViewControl();

            control.Dock = DockStyle.Fill;
            Controls.Add(control);
            var xwv = new CefSharpXWebView(control);

            control.SetVisibilityState(XWebViewVisibility.Visible);
            TradingView = new TradingView(xwv);
        }
예제 #2
0
        public TradingViewControl()
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
            InitializeComponent();
            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                try
                {
                    var img    = new Image();
                    var bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri(
                        "https://raw.githubusercontent.com/ExtremeDotneting/UndergroundIRO.TradingViewKit/master/data/splash.jpg",
                        UriKind.Absolute
                        );
                    bitmap.EndInit();
                    img.Stretch = Stretch.Fill;
                    img.Source  = bitmap;
                    Content     = img;
                }
                catch { }
                return;
            }
            var control = new CefSharpXWebViewControl();

            BrowserPlace.Content = control;
            var xwv = new CefSharpXWebView(control);

            TradingView = new TradingView(xwv);
            Unloaded   += delegate { TradingView.Dispose(); };
            LoadingImageGrid.Visibility = UseSplashScreen ? Visibility.Visible : Visibility.Collapsed;

            TradingView.Refreshing += async(tv, refreshType) =>
            {
                if (refreshType == ViewRefreshType.ReloadAllPage && UseSplashScreen)
                {
                    await tv.XWV.ThreadSync.InvokeAsync(() =>
                    {
                        LoadSplashScreenVisible = true;
                    });
                }
            };

            TradingView.Refreshed += async(tv, refreshType) =>
            {
                await tv.XWV.ThreadSync.InvokeAsync(() =>
                {
                    LoadSplashScreenVisible = false;
                });
            };
        }