private void newBrandLauncherView(Interop.SystemTime time, Brand brand) { BrandLauncherView view = new BrandLauncherView(this.time) { Top = Application.Current.MainWindow.Top, Left = Application.Current.MainWindow.Left + base.Width, Height = Application.Current.MainWindow.Height, DataContext = brand, Title = brand.NameAndFolder, ShowActivated = false, Owner = this }; _dictBrandLauncherView.Add(brand.BrandId, view); view.EventNewBrowserLauncherView += new Action <Interop.SystemTime, BrandProvider>(showBrowserLauncherView); view.Closing += new CancelEventHandler(closingViewer <BrandLauncherView>); this.currentBrandLauncher = view; this.currentBrandLauncher.Show(); }
private void Button_Click(Brand brandown) { LoadUpdates(); //minimizeMemory(); if (HaveNewUpdate) { this.BuildWindow(); HaveNewUpdate = false; } string url = ""; try { if (brandown != null) { if (brandown.MenuWindow) { BrandLauncherView view = new BrandLauncherView(this.time) { Top = Application.Current.MainWindow.Top, Left = Application.Current.MainWindow.Left + base.Width, Height = Application.Current.MainWindow.Height, DataContext = brandown, Title = brandown.NameAndFolder, ShowActivated = false, Owner = this }; this.brandLauncher = view; this.brandLauncher.Show(); } else if (brandown.Providers.Count > 0) { string loginFromDB = SettingsFactory.GetLoginFromDB(brandown.Providers[0].ProviderId); string pswFromDB = SettingsFactory.GetPswFromDB(brandown.Providers[0].ProviderId); string title = brandown.Providers[0].Title; url = brandown.Providers[0].Uri; if (url.StartsWith("http") || url.StartsWith("https")) { new BrowserLauncherView(url, title, this.time, loginFromDB, pswFromDB).Show(); } else { url = (url.StartsWith("http") || url.StartsWith("https")) ? url : Path.Combine(ResourceManager.Root, brandown.NameAndFolder, url); string str6 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ResourceManager.Root, brandown.NameAndFolder); using (Process process = new Process { StartInfo = { UseShellExecute = false, FileName = url, CreateNoWindow = true, Verb = url } }) { process.Start(); } } } } } catch (Exception exception) { ErrorLogHelper.AddErrorInLog("Button_Click", url + " | " + exception.Message + " | " + exception.StackTrace); MessageBox.Show(exception.Message + url + " | " + exception.StackTrace); } //Func<CatalogApi.Settings.Brand, bool> predicate = null; ////LoadUpdates(); //minimizeMemory(); //if (HaveNewUpdate) //{ // this.BuildWindow(); // HaveNewUpdate = false; //} //Button d = (Button)sender; //int brandId = ButtonBehavior.GetBrandId(d); //if (this.brandLauncher != null) //{ // this.brandLauncher.Close(); //} //foreach (GroupSet set in launcherSettings.Groups) //{ // foreach (CatalogApi.Settings.GroupBox box in set.GroupBoxs) // { // string url = ""; // try // { // if (predicate == null) // { // predicate = t => t.BrandId == brandId; // } // CatalogApi.Settings.Brand brand = box.Brands.FirstOrDefault<CatalogApi.Settings.Brand>(predicate); // if (brand != null) // { // if (brand.MenuWindow) // { // BrandLauncherView view = new BrandLauncherView(this.time) // { // Top = Application.Current.MainWindow.Top, // Left = Application.Current.MainWindow.Left + base.Width, // Height = Application.Current.MainWindow.Height, // DataContext = brand, // Title = brand.NameAndFolder, // ShowActivated = false, // Owner = this // }; // this.brandLauncher = view; // this.brandLauncher.Show(); // } // else if (brand.Providers.Count > 0) // { // string loginFromDB = SettingsFactory.GetLoginFromDB(brand.Providers[0].ProviderId); // string pswFromDB = SettingsFactory.GetPswFromDB(brand.Providers[0].ProviderId); // string title = brand.Providers[0].Title; // url = brand.Providers[0].Uri; // if (url.StartsWith("http") || url.StartsWith("https")) // { // new BrowserLauncherView(url, title, this.time, loginFromDB, pswFromDB).Show(); // } // else // { // url = (url.StartsWith("http") || url.StartsWith("https")) ? url : Path.Combine(ResourceManager.Root, brand.NameAndFolder, url); // string str6 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ResourceManager.Root, brand.NameAndFolder); // using (Process process = new Process { StartInfo = { UseShellExecute = false, FileName = url, CreateNoWindow = true, Verb = url } }) // { // process.Start(); // } // } // } // } // } // catch (Exception exception) // { // ErrorLogHelper.AddErrorInLog("Button_Click", url + " | " + exception.Message + " | " + exception.StackTrace); // MessageBox.Show(exception.Message + url + " | " + exception.StackTrace); // } // } //} }