Example #1
0
        public BrowserTabViewModel(string address)
        {
            Address         = address;
            AddressEditable = Address;

            GoCommand   = new RelayCommand(Go, () => !String.IsNullOrWhiteSpace(Address));  // 주목할점이 ICommand 인터페이스 구현을 한줄만에 끝냄.
            HomeCommand = new RelayCommand(() => AddressEditable = Address = DefaultUrl);
            ExecuteJavaScriptCommand    = new RelayCommand <string>(ExecuteJavaScript, s => !String.IsNullOrWhiteSpace(s));
            EvaluateJavaScriptCommand   = new RelayCommand <string>(EvaluateJavaScript, s => !String.IsNullOrWhiteSpace(s));
            ShowDevToolsCommand         = new RelayCommand(() => WebBrowser.ShowDevTools());
            CloseDevToolsCommand        = new RelayCommand(() => WebBrowser.CloseDevTools());
            JavascriptBindingStressTest = new RelayCommand(() =>
            {
                WebBrowser.Load(DefaultUrl);
                WebBrowser.LoadingStateChanged += (e, args) =>
                {
                    if (args.IsLoading == false)
                    {
                        Task.Delay(10000).ContinueWith(t =>
                        {
                            if (WebBrowser != null)
                            {
                                WebBrowser.Reload();
                            }
                        });
                    }
                };
            });

            PropertyChanged += OnPropertyChanged;

            var version = string.Format("Chromium: {0}, CEF: {1}, CefSharp: {2}", Cef.ChromiumVersion, Cef.CefVersion, Cef.CefSharpVersion);

            OutputMessage = version;
        }