///////////////////////////////////////////////////////////////////////////////////////////////////// // NON-PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Creates a new web browser <see cref="DocumentWindow"/>. /// </summary> /// <param name="url">The URL to load.</param> /// <returns>The <see cref="DocumentWindow"/> that was created.</returns> private DocumentWindow CreateBrowserWindow(string url) { var browser = new WebBrowser(); InteropFocusTracking.SetIsEnabled(browser, true); WebBrowserBehavior.SetAreScriptErrorsDisabled(browser, true); // Create the document var documentWindow = new DocumentWindow(dockSite, "Browser" + (++browserIndex), "New Tab", null, browser); // Activate the document documentWindow.Activate(); // Navigate to a page browser.Navigate(url); return(documentWindow); }
public MainWindowViewModel() { EditViewModel = new EditViewModel(this); BrowserViewModel = new BrowserViewModel(); VisualViewModel = new VisualViewModel(); SettingViewModel = new SettingViewModel(); CountryModel = CountryModel.Instance; EditViewCommand = new ActionCommand(delegate { CurrentViewModel = EditViewModel; }); BrowserViewCommand = new ActionCommand(delegate { CurrentViewModel = BrowserViewModel; }); VisualViewCommand = new ActionCommand(delegate { CurrentViewModel = VisualViewModel; }); SettingViewCommand = new ActionCommand(delegate { CurrentViewModel = SettingViewModel; }); if (!File.Exists(Settings.settingsPath)) { CurrentViewModel = SettingViewModel; } else { CurrentViewModel = VisualViewModel; // call last saved viewModel!!!! } PlayProgramCommand = new ActionCommand(Play, CanPlay); RecordCommand = new ActionCommand(Record, CanRecord); MuteCommand = new ActionCommand(Silence, (o) => { return(true); }); WebRadioControl.Instance.OnMessageChanged += ((s, args) => { if (args.Message != null) { Message = args.Message; if (Message.StatusColorString == "Green") //program started { Settings.Properties["LastVisitedUrl"] = EditViewModel.CurrentItem.Url; } } }); PlayButtonIconPath = Settings.ResourcePath + "play.png"; FavoriteButtonIconPath = Settings.ResourcePath + "white.png"; if (Settings.Properties.Contains("Volume")) { Volume = float.Parse((string)Settings.Properties["Volume"]); } else { Volume = 10; } if (Settings.Properties.Contains("LastVisitedUrl")) { FindTreeNode((string)ViewModels.Settings.Properties["LastVisitedUrl"]); } Favorite1Command = new ActionCommand((o) => { Favorite("Favorite1"); }, (o) => { return(IsFavorite("Favorite1")); }); Favorite2Command = new ActionCommand((o) => { Favorite("Favorite2"); }, (o) => { return(IsFavorite("Favorite2")); }); Favorite3Command = new ActionCommand((o) => { Favorite("Favorite3"); }, (o) => { return(IsFavorite("Favorite3")); }); AddFavoriteCommand = new ActionCommand((o) => { IsAddFavorite = true; FavoriteButtonIconPath = Settings.ResourcePath + "Redmark.png"; }, (o) => { return(EditViewModel.CurrentItem != null); }); if (Settings.Properties.Contains("Favorite1")) { favorite1Name = ((FavoriteItem)Settings.Properties["Favorite1"]).Name; } if (Settings.Properties.Contains("Favorite2")) { favorite2Name = ((FavoriteItem)Settings.Properties["Favorite2"]).Name; } if (Settings.Properties.Contains("Favorite3")) { favorite3Name = ((FavoriteItem)Settings.Properties["Favorite3"]).Name; } WebBrowserBehavior.FixBrowserVersion(); // Eintrag in registry }