public TaskDataSelectionForm() { //Create the UI InitializeComponent(); Theming.ApplyTheme(this); //Insert the types of erasure targets foreach (IErasureTarget target in Host.Instance.ErasureTargetFactories) { typeCmb.Items.Add(new ErasureType(target)); } if (typeCmb.Items.Count != 0) { typeCmb.SelectedIndex = 0; } //And the methods list methodCmb.Items.Add(ErasureMethodRegistrar.Default); foreach (IErasureMethod method in Host.Instance.ErasureMethods) { methodCmb.Items.Add(method); } if (methodCmb.Items.Count != 0) { methodCmb.SelectedIndex = 0; } }
private void InitIcons() { this.ImageUpLeft.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Icons\\Connected\\virus.png"))); this.ImageUpRight.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Icons\\Connected\\tracking-2.png"))); this.ImageDownLeft.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Icons\\Connected\\adblock.png"))); this.ImageDownRight.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Icons\\Connected\\time.png"))); }
public ConnectedWifi() { this.InitializeComponent(); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.UriSource = new Uri(Theming.GetThemedImage("Background\\stats-wifi-ghostie.gif")); bitmapImage.EndInit(); ImageBehavior.SetAnimatedSource(this.SurfingAnimated, bitmapImage); this._wiFiDetector.add_OnNewWiFiDetected(new WiFiDetector.NewWiFiDetected(this._wiFiDetector_OnNewWiFiDetected)); this._wiFiDetector.add_OnSignalStrengthChanged(new WiFiDetector.SignalStrengthChanged(this._wiFiDetector_OnSignalStrengthChanged)); this._wiFiDetector.add_OnWifiDisconnected(new WiFiDetector.NewWiFiDetected(this._wiFiDetector_OnWifiDisconnected)); this._wiFiDetector.set_Enabled(true); this.< IconPathString > k__BackingField = Theming.GetThemedImage("Icons\\ProfileTabs\\ico-wifi-color.png"); try { this.Surfing.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\stats-surfen-ghostie.png"))); } catch (FileNotFoundException ex) { DebugLogHelper.Instance.Info(string.Format("{0}.{1} {2}", base.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message)); } catch (ArgumentNullException ex2) { DebugLogHelper.Instance.Info(string.Format("{0}.{1} {2}", base.GetType().Name, MethodBase.GetCurrentMethod().Name, ex2.Message)); } }
public UnusedSpaceErasureTargetConfigurer() { InitializeComponent(); Theming.ApplyTheme(this); //Populate the drives list foreach (VolumeInfo volume in VolumeInfo.Volumes.Concat(VolumeInfo.NetworkDrives)) { DriveType driveType = volume.VolumeType; if (driveType != DriveType.Unknown && driveType != DriveType.NoRootDirectory && driveType != DriveType.CDRom) { //Skip drives which are not mounted: we cannot erase their unused space. if (!volume.IsMounted) { continue; } DriveItem item = new DriveItem(); DirectoryInfo root = volume.MountPoints[0]; item.Drive = root.FullName; item.Label = root.GetDescription(); item.Icon = root.GetIcon(); unusedDisk.Items.Add(item); } } if (unusedDisk.Items.Count != 0) { unusedDisk.SelectedIndex = 0; } }
public LogForm(Task task) { InitializeComponent(); Theming.ApplyTheme(this); //Update the title Text = string.Format(CultureInfo.InvariantCulture, "{0} - {1}", Text, task); //Populate the list of sessions foreach (LogSinkBase sink in task.Log) { filterSessionCombobox.Items.Add(sink.StartTime); } if (filterSessionCombobox.Items.Count != 0) { filterSessionCombobox.SelectedIndex = filterSessionCombobox.Items.Count - 1; } //Set the filter settings filterFilterTypeCombobox.SelectedIndex = 0; filterSeverityCombobox.SelectedIndex = 0; //Display the log entries Task = task; RefreshMessages(); EnableButtons(); //Register our event handler to get live log messages if (Task.Log.Count > 0) { Task.Log.Last().Chain(this); } Task.TaskStarted += task_TaskStarted; }
private void InitIcons() { this._iosLogoUri = new Uri(Theming.GetThemedImage("Icons\\DeviceTabs\\ios.png")); this._macosLogoUri = new Uri(Theming.GetThemedImage("Icons\\DeviceTabs\\macos.png")); this._windowsLogoUri = new Uri(Theming.GetThemedImage("Icons\\DeviceTabs\\windows.png")); this._androidLogoUri = new Uri(Theming.GetThemedImage("Icons\\DeviceTabs\\android.png")); this._otherLogoUri = new Uri(Theming.GetThemedImage("Icons\\DeviceTabs\\custom.png")); }
public void OnNavigatedTo() { if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileAnonymousBrowsing())) { if (File.Exists(Theming.GetThemedImage("Background\\anonSurfBack.png"))) { this.BackgroundImage.ImageSource = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\anonSurfBack.png"))); } this.LblUpLeftFirstLine.Foreground = (base.FindResource("BrushColorYellow") as SolidColorBrush); this.LblUpRightFirstLine.Foreground = (base.FindResource("BrushColorYellow") as SolidColorBrush); this.LblDownLeftFirstLine.Foreground = (base.FindResource("BrushColorYellow") as SolidColorBrush); this.LblDownRightFirstLine.Foreground = (base.FindResource("BrushColorYellow") as SolidColorBrush); } if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileAnonymousDownloading())) { if (File.Exists(Theming.GetThemedImage("Background\\anonDownloadBack.png"))) { this.BackgroundImage.ImageSource = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\anonDownloadBack.png"))); } this.LblUpLeftFirstLine.Foreground = (base.FindResource("ProfileAnonDownloadColorBrush") as SolidColorBrush); this.LblUpRightFirstLine.Foreground = (base.FindResource("ProfileAnonDownloadColorBrush") as SolidColorBrush); this.LblDownLeftFirstLine.Foreground = (base.FindResource("ProfileAnonDownloadColorBrush") as SolidColorBrush); this.LblDownRightFirstLine.Foreground = (base.FindResource("ProfileAnonDownloadColorBrush") as SolidColorBrush); } if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileCustom())) { if (File.Exists(Theming.GetThemedImage("Background\\stats-settingsBack.png"))) { this.BackgroundImage.ImageSource = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\stats-settingsBack.png"))); } this.LblUpLeftFirstLine.Foreground = (base.FindResource("MangentaBaseBrush") as SolidColorBrush); this.LblUpRightFirstLine.Foreground = (base.FindResource("MangentaBaseBrush") as SolidColorBrush); this.LblDownLeftFirstLine.Foreground = (base.FindResource("MangentaBaseBrush") as SolidColorBrush); this.LblDownRightFirstLine.Foreground = (base.FindResource("MangentaBaseBrush") as SolidColorBrush); } if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileNetwork()) || ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileWifi())) { if (File.Exists(Theming.GetThemedImage("Background\\stats-wifi.png"))) { this.BackgroundImage.ImageSource = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\stats-wifi.png"))); } this.LblUpLeftFirstLine.Foreground = (base.FindResource("ProfileWifiColorBrush") as SolidColorBrush); this.LblUpRightFirstLine.Foreground = (base.FindResource("ProfileWifiColorBrush") as SolidColorBrush); this.LblDownLeftFirstLine.Foreground = (base.FindResource("ProfileWifiColorBrush") as SolidColorBrush); this.LblDownRightFirstLine.Foreground = (base.FindResource("ProfileWifiColorBrush") as SolidColorBrush); } this.TrafficData = GuiHelper.ResetTrafficData(); this.SwitchLeft.Visibility = Visibility.Hidden; this.SwitchRight.Visibility = Visibility.Hidden; ObjectHolder.ConnectedDispatcherTimer = this._generalDispatcherTimer; if (!this._stopWatch.IsRunning) { this._stopWatch.Stop(); this._stopWatch.Reset(); this._timerForStopWatch.Start(); } }
public BaseMixpanelObject() { this.Cg5Upgrade = SettingsHolder.get_Settings().get_IsCg5Upgrade(); this.DistinctId = ((!this.Cg5Upgrade) ? SettingsHolder.get_Settings().get_DistinctId() : BaseMixpanelObject.GetDistinctIdHmac(SettingsHolder.get_Settings().get_DistinctId())); if (SettingsHolder.get_Settings().get_LoginServer().Contains("dev-api.cyberghostvpn.com")) { this.Environment = "dev"; } else if (SettingsHolder.get_Settings().get_LoginServer().Contains("beta-api.cyberghostvpn.com")) { this.Environment = "beta"; } else { this.Environment = "live"; } if (ObjectHolder.CurrentStatus != null) { this.ApiVersion = string.Format("{0}-{1}", ObjectHolder.CurrentStatus.get_JsApi(), ObjectHolder.CurrentStatus.get_PhpApi()); this.Ip = ObjectHolder.CurrentStatus.get_RealIp(); } this.Country = HelperFunctions.GetSystemRegionCode(); this.ClientLanguage = SettingsHolder.get_Settings().get_Language(); this.AppName = Theming.GetProductName(); if (ObjectHolder.CurrentUser != null && ObjectHolder.CurrentUser.get_Subscription() != null && ObjectHolder.CurrentUser.get_Subscription().get_Product() != null) { this.PlanId = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_PlansId(); this.PlanName = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Plan().get_InternalName(); if (ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Plan().get_TrialPeriodDays() > 0) { this.PlanType = "trial"; } else { this.PlanType = (ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Plan().get_Free() ? "free" : (ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Plan().get_Promo() ? "promo" : "paid")); } this.ProductId = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Id(); this.ProductName = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_InternalName(); this.BillingType = (ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Recurring() ? "recurring" : "prepaid"); this.BillingIntervalMonths = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Months(); this.BillingIntervalDays = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Days(); } this.Currency = NumberFormatInfo.CurrentInfo.CurrencySymbol; this.Os = "win"; this.Architecture = (System.Environment.Is64BitOperatingSystem ? "x64" : "x86"); this.OsVersion = HelperFunctions.GetOsVersion().ToString(); this.AffiliateId = Constants.get_AffiliateId(); this.ClientVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.SuccesfullConnections = SettingsHolder.get_Settings().get_TotalConnectionsOk(); this.UnsuccesfullConnections = SettingsHolder.get_Settings().get_TotalConnectionFailed(); this.ConnectionAttempts = SettingsHolder.get_Settings().get_TotalConnectionAttempts(); this.ApplicationLaunches = SettingsHolder.get_Settings().get_TotalApplicationLaunches(); this.TotalSecureHotspotsProtected = SettingsHolder.get_Settings().get_WiFiSecureSsids().Count; this.TotalUnsecureHotspotsProtected = SettingsHolder.get_Settings().get_WiFiUnsecureSsids().Count; this.LastUsedProfile = SettingsHolder.get_Settings().get_LastConnectedProfile(); }
void OnThemeChanged(object sender, EventArgs e) { var picker = (Picker)sender; int selectedIndex = picker.SelectedIndex; Theming.ChangeTheme(selectedIndex.ToString()); var db = Services.XServices.Instance.GetService <Services.IDatabase>(); db.WriteSetting("Theme", selectedIndex.ToString()); }
public TaskPropertiesForm() { InitializeComponent(); Theming.ApplyTheme(this); scheduleTime.CustomFormat = DateTimeFormatInfo.CurrentInfo.ShortTimePattern; //Set a default task type typeManual.Checked = true; scheduleDaily.Checked = true; }
private void InitIcons() { this.StatsSurfenGhostieBackground = new Uri(Theming.GetThemedImage("Background\\stats-surfen-ghostie.gif")); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.UriSource = this.StatsSurfenGhostieBackground; bitmapImage.EndInit(); ImageBehavior.SetAnimatedSource(this.SurfingAnimated, bitmapImage); this.Surfing.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\stats-surfen-ghostie.png"))); }
public DriveErasureTargetConfigurer() { InitializeComponent(); Theming.ApplyTheme(this); //Populate the drives list List <VolumeInfo> volumes = new List <VolumeInfo>(); foreach (PhysicalDriveInfo drive in PhysicalDriveInfo.Drives) { PartitionItem item = new PartitionItem(); item.PhysicalDrive = drive; partitionCmb.Items.Add(item); foreach (VolumeInfo volume in drive.Volumes) { item = new PartitionItem(); item.Volume = volume; if (volume.IsMounted) { DirectoryInfo root = volume.MountPoints[0]; item.Icon = root.GetIcon(); } partitionCmb.Items.Add(item); volumes.Add(volume); } } //And then add volumes which aren't accounted for (notably, Dynamic volumes) foreach (VolumeInfo volume in VolumeInfo.Volumes) { if (volumes.IndexOf(volume) == -1 && volume.VolumeType == DriveType.Fixed) { PartitionItem item = new PartitionItem(); item.Volume = volume; if (volume.IsMounted) { DirectoryInfo root = volume.MountPoints[0]; item.Icon = root.GetIcon(); } partitionCmb.Items.Insert(0, item); volumes.Add(volume); } } if (partitionCmb.Items.Count != 0) { partitionCmb.SelectedIndex = 0; } }
private void SetCountryLabel() { try { if (!string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemCountryCode())) { this.LblImageCountry.Source = new BitmapImage(new Uri(Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemCountryCode()))))); } } catch (Exception) { } }
private void InitIcons() { this.StatsUnblockGhostieBackground = new Uri(Theming.GetThemedImage("Background\\stats-unlock-ghostie.gif")); this.IconPlayPath = new Uri(Theming.GetThemedImage("Icons\\Functions\\icon_play.png")); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.UriSource = this.StatsUnblockGhostieBackground; bitmapImage.EndInit(); ImageBehavior.SetAnimatedSource(this.UnblockingAnimated, bitmapImage); this.GridBackground.ImageSource = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\unblockBack.png"))); this.Unblocking.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\stats-unlock-ghostie.png"))); }
public ProgressForm(Task task) { InitializeComponent(); Theming.ApplyTheme(this); this.task = task; this.lastUpdate = DateTime.Now; this.ActiveControl = hide; //Register the event handlers jobTitle.Text = task.ToString(); task.TaskFinished += task_TaskFinished; //Set the current progress UpdateProgress(); }
private void InitIcons() { this._freeImageAnonDownload = new Uri(Theming.GetThemedImage("Icons\\ProfileTabs\\ico-download.png")); this._freeImageAnonSurf = new Uri(Theming.GetThemedImage("Icons\\ProfileTabs\\ico-browse.png")); this._freeImageAntiCensor = new Uri(Theming.GetThemedImage("Icons\\ProfileTabs\\ico-anti.png")); this._freeImageCustom = new Uri(Theming.GetThemedImage("Icons\\ProfileTabs\\ico-setting.png")); this._freeImageNetwork = new Uri(Theming.GetThemedImage("Icons\\ProfileTabs\\ico-lan.png")); this._freeImageUnblock = new Uri(Theming.GetThemedImage("Icons\\ProfileTabs\\ico-unblock.png")); this._freeImageWifi = new Uri(Theming.GetThemedImage("Icons\\ProfileTabs\\ico-wifi.png")); this._premiumImageAnonDownload = new Uri(Theming.GetThemedImage(string.Format("Icons\\ProfileTabs\\HomePremium_{0}\\ico-download.png", SettingsHolder.get_Settings().get_Language()))); this._premiumImageAnonSurf = new Uri(Theming.GetThemedImage(string.Format("Icons\\ProfileTabs\\HomePremium_{0}\\ico-browse.png", SettingsHolder.get_Settings().get_Language()))); this._premiumImageAntiCensor = new Uri(Theming.GetThemedImage(string.Format("Icons\\ProfileTabs\\HomePremium_{0}\\ico-anti.png", SettingsHolder.get_Settings().get_Language()))); this._premiumImageCustom = new Uri(Theming.GetThemedImage(string.Format("Icons\\ProfileTabs\\HomePremium_{0}\\ico-setting.png", SettingsHolder.get_Settings().get_Language()))); this._premiumImageNetwork = new Uri(Theming.GetThemedImage(string.Format("Icons\\ProfileTabs\\HomePremium_{0}\\ico-lan.png", SettingsHolder.get_Settings().get_Language()))); this._premiumImageUnblock = new Uri(Theming.GetThemedImage(string.Format("Icons\\ProfileTabs\\HomePremium_{0}\\ico-unblock.png", SettingsHolder.get_Settings().get_Language()))); this._premiumImageWifi = new Uri(Theming.GetThemedImage(string.Format("Icons\\ProfileTabs\\HomePremium_{0}\\ico-wifi.png", SettingsHolder.get_Settings().get_Language()))); }
async void Theme_Clicked(object sender, EventArgs e) { Frame bt = (Frame)sender; await FadeOutIn(bt); var action = await DisplayActionSheet(Services.TranslateExtension.TranslateText("choose_theme"), Services.TranslateExtension.TranslateText("cancel"), null, "Comos" , "Siemens", "Light", "Black"); if (action != Services.TranslateExtension.TranslateText("cancel")) { Theming.ChangeTheme(action); var db = Services.XServices.Instance.GetService <Services.IDatabase>(); db.WriteSetting("Theme", action); } }
public ProgramData(string fileName, bool visible = false) { string text = this.IconFromFilePath(fileName); if (!string.IsNullOrEmpty(text) && File.Exists(text)) { this.ExeImage = new Uri(text); } else { this.ExeImage = new Uri(Theming.GetThemedImage("Icons\\Functions\\blank_tile.png")); } this.ExeName = Path.GetFileName(fileName); this.Tag = ""; this.ToolTip = fileName; this.ApplicationExe = fileName; this.Visible = visible; }
public ShellConfirmationDialog(Task task) { Task = task; InitializeComponent(); Theming.ApplyTheme(this); //Set the icon of the dialog Bitmap bitmap = new Bitmap(Image.Width, Image.Height); using (Graphics g = Graphics.FromImage(bitmap)) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.DrawIcon(SystemIcons.Exclamation, new Rectangle(Point.Empty, Image.Size)); } Image.Image = bitmap; //Focus on the No button NoBtn.Focus(); }
private void UpdateConnectedPanel() { if (ObjectHolder.ConnectionStatus != -1 && ObjectHolder.CurrentConnectionInfos != null) { this.connected_Profile.Text = SettingsHolder.get_Settings().get_ConnectedProfileNamePretty(); this.connected_ServerName.Text = string.Format("{0} ({1})", ObjectHolder.CurrentConnectionInfos.ServerName, ObjectHolder.CurrentConnectionInfos.ServerIp); string themedImage = Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", ObjectHolder.CurrentConnectionInfos.ServerCountry.ToLower()))); if (File.Exists(themedImage)) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.UriSource = new Uri(themedImage); bitmapImage.EndInit(); this.connected_CountryImage.Source = bitmapImage; } this.connected_Info.Visibility = Visibility.Visible; return; } this.connected_Info.Visibility = Visibility.Collapsed; }
public SchedulerPanel() { InitializeComponent(); Theming.ApplyTheme(schedulerDefaultMenu); if (!IsHandleCreated) { CreateHandle(); } //Populate the scheduler list-view with the current task list ExecutorTasksCollection tasks = Program.eraserClient.Tasks; foreach (Task task in tasks) { CreateTask(task); } //Hook the event machinery to our class. Handle the task Added and Removed //events. Program.eraserClient.TaskAdded += TaskAdded; Program.eraserClient.TaskDeleted += TaskDeleted; }
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var window = System.Windows.Window.GetWindow(this); if (window is null) { return; } var me = (ListBox)sender; var theme = me.SelectedIndex switch { 0 => Theme.Light, 1 => Theme.Dark, 2 => new() { Active = Color.FromRgb(0x00, 0xFF, 0x00), Inactive = Color.FromRgb(0xFF, 0x00, 0x00), Background = Color.FromRgb(0x00, 0x00, 0x00), AccentForeground = Color.FromRgb(0x00, 0x00, 0x00), AccentBackground = Color.FromRgb(0xFF, 0xFF, 0x00) }, 3 => new() { Active = Color.FromRgb(0x00, 0xFF, 0xFF), Inactive = Color.FromRgb(0x00, 0x7F, 0x7F), Background = Color.FromRgb(0x00, 0x00, 0x00), AccentForeground = Color.FromRgb(0x00, 0x00, 0x00), AccentBackground = Color.FromRgb(0x00, 0xFF, 0xFF) }, _ => null }; if (theme is not null) { Theming.SetTheme(window, theme); } }
public void OnNavigatedTo(NavigationEventArgs e) { this.UpgradeBtn.CurrentProfile = SettingsHolder.get_Settings().get_ProfileCustom(); this.UpgradeBtn.SetVisibility(this.ConnectBtn, 16); this.InfoFooter.Profile = SettingsHolder.get_Settings().get_ProfileCustom(); this.ConnectBtn.IsEnabled = false; this.SelectedLabel.Visibility = Visibility.Hidden; if (SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerId() > 0 || !string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountry()) || !string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountryDisplay())) { this.SelectedLabel.Visibility = Visibility.Visible; this.ConnectBtn.IsEnabled = true; } ObjectHolder.MainForm.set_IsNavigationVisible(true); this.ServerOption.Content = SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerName(); if (string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerName())) { this.ServerOption.Content = SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerDisplayName(); } string themedImage = Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountry()))); if (string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountry())) { themedImage = Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountryDisplay()))); } if (!string.IsNullOrEmpty(themedImage) && File.Exists(themedImage)) { this.ServerImage.Visibility = Visibility.Visible; this.ServerImage.Source = new BitmapImage(new Uri(string.Format(themedImage, new object[0]))); } else { this.ServerImage.Visibility = Visibility.Hidden; } this.FeatureGroup.CurrentProfile = SettingsHolder.get_Settings().get_ProfileCustom(); this.FeatureGroup.BindFeatures(); ObjectHolder.CurrentProfileTab = "extra features"; GuiHelper.SetUpgradeBarVisiblity(this.FeatureGroup); }
private void SetCountryImage() { try { if (ObjectHolder.ConnectionStatus != null) { this.LblCountry.Text = Profiles.COUNTRY; if (File.Exists(this.IcoBlankFlag.ToString())) { this.LblImageCountry.Source = new BitmapImage(this.IcoBlankFlag); } } else if (!string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileUncensoring().get_SelectedItemCountryCode())) { string selectedItemCountryCode = SettingsHolder.get_Settings().get_ProfileUncensoring().get_SelectedItemCountryCode(); this.LblCountry.Text = GuiHelper.FindTranslationForCountry(selectedItemCountryCode); this.LblImageCountry.Source = new BitmapImage(new Uri(Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", SettingsHolder.get_Settings().get_ProfileUncensoring().get_SelectedItemCountryCode()))))); } } catch (Exception) { } }
private void InitIcons() { this.IcoBlankFlag = new Uri(Theming.GetThemedImage("Icons\\Flags\\24\\blank.png")); this.GridBackground.ImageSource = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\anticensorBack.png"))); this.Unblocking.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\anticensor.png"))); }
private void InitIcons() { this.GhostyImage.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\friends.png"))); }
public MainForm() { InitializeComponent(); SettingsPage = new SettingsPanel(); SchedulerPage = new SchedulerPanel(); contentPanel.Controls.Add(SchedulerPage); contentPanel.Controls.Add(SettingsPage); if (!IsHandleCreated) { CreateHandle(); } Theming.ApplyTheme(this); Theming.ApplyTheme(notificationMenu); //We need to see if there are any tools to display foreach (IClientTool tool in Host.Instance.ClientTools) { tool.RegisterTool(tbToolsMenu); } if (tbToolsMenu.Items.Count == 0) { //There are none, hide the menu tbTools.Visible = false; tbToolsDropDown.Visible = false; } //We also need to see if we have any notifier classes we need to register. foreach (INotifier notifier in Host.Instance.Notifiers) { notifier.Sink = this; } Host.Instance.Notifiers.Registered += Notifier_Registered; //For every task we need to register the Task Started and Task Finished //event handlers for progress notifications foreach (Task task in Program.eraserClient.Tasks) { OnTaskAdded(this, new TaskEventArgs(task)); } Program.eraserClient.TaskAdded += OnTaskAdded; Program.eraserClient.TaskDeleted += OnTaskDeleted; //Check if we have tasks running already. foreach (Task task in Program.eraserClient.Tasks) { if (task.Executing) { OnTaskProcessing(task, EventArgs.Empty); break; } } //Check the notification area context menu's minimise to tray item. hideWhenMinimisedToolStripMenuItem.Checked = EraserSettings.Get().HideWhenMinimised; //Set the docking style for each of the pages SchedulerPage.Dock = DockStyle.Fill; SettingsPage.Visible = false; //Show the default page. ChangePage(MainFormPage.Scheduler); }
private static void Start() { DiscordLauncherPresence.Start("Start Up", null); if (!UnixOS.Detected()) { DiscordLauncherPresence.Status("Start Up", "Checking .NET Framework"); try { /* Check if User has a compatible .NET Framework Installed */ if (int.TryParse(RegistryCore.Read("Release", @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"), out int NetFrame_Version)) { /* For now, allow edge case of Windows 8.0 to run .NET 4.6.1 where upgrading to 8.1 is not possible */ if (WindowsProductVersion.GetWindowsNumber() == 6.2 && NetFrame_Version <= 394254) { if (MessageBox.Show(null, Translations.Database("Program_TextBox_NetFrame_P1") + " .NETFramework, Version=v4.6.1 \n\n" + Translations.Database("Program_TextBox_NetFrame_P2"), "GameLauncher.exe - " + Translations.Database("Program_TextBox_NetFrame_P3"), MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { Process.Start("https://dotnet.microsoft.com/download/dotnet-framework/net461"); } FunctionStatus.LauncherForceClose = true; } /* Otherwise, all other OS Versions should have 4.6.2 as a Minimum Version */ else if (NetFrame_Version <= 394802) { if (MessageBox.Show(null, Translations.Database("Program_TextBox_NetFrame_P1") + " .NETFramework, Version=v4.6.2 \n\n" + Translations.Database("Program_TextBox_NetFrame_P2"), "GameLauncher.exe - " + Translations.Database("Program_TextBox_NetFrame_P3"), MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { Process.Start("https://dotnet.microsoft.com/download/dotnet-framework"); } FunctionStatus.LauncherForceClose = true; } else { Log.System("NET-FRAMEWORK: Supported Installed Version"); } } else { Log.Warning("NET-FRAMEWORK: Failed to Parse Version"); } } catch { FunctionStatus.LauncherForceClose = true; } } if (FunctionStatus.LauncherForceClose) { FunctionStatus.ErrorCloseLauncher("Closing From .NET Framework Check", false); } else { /* Splash Screen */ if (!Debugger.IsAttached) { /* Starts Splash Screen */ SplashScreen.ThreadStatus("Start"); } LogToFileAddons.RemoveLogs(); Log.StartLogging(); Log.Info("CURRENT DATE: " + Time.GetTime("Date")); Log.Checking("LAUNCHER MIGRATION: Appdata and/or Roaming Folders"); /* Deletes Folders that will Crash the Launcher (Cleanup Migration) */ try { if (Directory.Exists(Strings.Encode(Path.Combine(Locations.LocalAppDataFolder, "Soapbox_Race_World")))) { Directory.Delete(Strings.Encode(Path.Combine(Locations.LocalAppDataFolder, "Soapbox_Race_World")), true); } if (Directory.Exists(Strings.Encode(Path.Combine(Locations.RoamingAppDataFolder, "Soapbox_Race_World")))) { Directory.Delete(Strings.Encode(Path.Combine(Locations.RoamingAppDataFolder, "Soapbox_Race_World")), true); } if (Directory.Exists(Strings.Encode(Path.Combine(Locations.LocalAppDataFolder, "SoapBoxRaceWorld")))) { Directory.Delete(Strings.Encode(Path.Combine(Locations.LocalAppDataFolder, "SoapBoxRaceWorld")), true); } if (Directory.Exists(Strings.Encode(Path.Combine(Locations.RoamingAppDataFolder, "SoapBoxRaceWorld")))) { Directory.Delete(Strings.Encode(Path.Combine(Locations.RoamingAppDataFolder, "SoapBoxRaceWorld")), true); } if (Directory.Exists(Strings.Encode(Path.Combine(Locations.LocalAppDataFolder, "WorldUnited.gg")))) { Directory.Delete(Strings.Encode(Path.Combine(Locations.LocalAppDataFolder, "WorldUnited.gg")), true); } if (Directory.Exists(Strings.Encode(Path.Combine(Locations.RoamingAppDataFolder, "WorldUnited.gg")))) { Directory.Delete(Strings.Encode(Path.Combine(Locations.RoamingAppDataFolder, "WorldUnited.gg")), true); } } catch (Exception Error) { LogToFileAddons.OpenLog("LAUNCHER MIGRATION", null, Error, null, true); } Log.Completed("LAUNCHER MIGRATION"); Log.Checking("LAUNCHER XML: If File Exists or Not"); DiscordLauncherPresence.Status("Start Up", "Checking if UserSettings XML Exists"); /* Create Default Configuration Files (if they don't already exist) */ if (!File.Exists(Locations.UserSettingsXML)) { try { if (!Directory.Exists(Locations.UserSettingsFolder)) { Directory.CreateDirectory(Locations.UserSettingsFolder); } File.WriteAllBytes(Locations.UserSettingsXML, ExtractResource.AsByte("GameLauncher.Resources.UserSettings.UserSettings.xml")); } catch (Exception Error) { LogToFileAddons.OpenLog("LAUNCHER XML", null, Error, null, true); } } Log.Completed("LAUNCHER XML"); string Insider = string.Empty; if (EnableInsiderDeveloper.Allowed()) { Insider = "DEV TEST "; } else if (EnableInsiderBetaTester.Allowed()) { Insider = "BETA TEST "; } Log.Build(Insider + "BUILD: GameLauncher " + Application.ProductVersion + "_" + InsiderInfo.BuildNumberOnly()); Log.Checking("OS: Detecting"); DiscordLauncherPresence.Status("Start Up", "Checking Operating System"); try { if (UnixOS.Detected()) { InformationCache.OSName = UnixOS.FullName(); Log.System("SYSTEM: Detected OS: " + InformationCache.OSName); } else { InformationCache.OSName = WindowsProductVersion.ConvertWindowsNumberToName(); Log.System("SYSTEM: Detected OS: " + InformationCache.OSName); Log.System("SYSTEM: Windows Build: " + WindowsProductVersion.GetWindowsBuildNumber()); Log.System("SYSTEM: NT Version: " + Environment.OSVersion.VersionString); Log.System("SYSTEM: Video Card: " + HardwareInfo.GPU.CardName()); Log.System("SYSTEM: Driver Version: " + HardwareInfo.GPU.DriverVersion()); } Log.Completed("OS: Detected"); } catch (Exception Error) { LogToFileAddons.OpenLog("SYSTEM", null, Error, null, true); FunctionStatus.LauncherForceCloseReason = "Code: 0\n" + Translations.Database("Program_TextBox_System_Detection") + "\n" + Error.Message; FunctionStatus.LauncherForceClose = true; } if (FunctionStatus.LauncherForceClose) { FunctionStatus.ErrorCloseLauncher("Closing From Operating System Check", false); } else { /* Set Launcher Directory */ Log.Checking("SETUP: Setting Launcher Folder Directory"); Directory.SetCurrentDirectory(Locations.LauncherFolder); Log.Completed("SETUP: Current Directory now Set at -> " + Locations.LauncherFolder); if (!UnixOS.Detected()) { Log.Checking("FOLDER LOCATION: Checking Launcher Folder Directory"); DiscordLauncherPresence.Status("Start Up", "Checking Launcher Folder Locations"); switch (FunctionStatus.CheckFolder(Locations.LauncherFolder)) { case FolderType.IsTempFolder: case FolderType.IsUsersFolders: case FolderType.IsProgramFilesFolder: case FolderType.IsWindowsFolder: case FolderType.IsRootFolder: String Constructed_Msg = String.Empty; Constructed_Msg += Translations.Database("Program_TextBox_Folder_Check_Launcher") + "\n\n"; Constructed_Msg += Translations.Database("Program_TextBox_Folder_Check_Launcher_P2") + "\n"; Constructed_Msg += "• X:\\GameLauncher.exe " + Translations.Database("Program_TextBox_Folder_Check_Launcher_P3") + "\n"; Constructed_Msg += "• C:\\Program Files\n"; Constructed_Msg += "• C:\\Program Files (x86)\n"; Constructed_Msg += "• C:\\Users " + Translations.Database("Program_TextBox_Folder_Check_Launcher_P4") + "\n"; Constructed_Msg += "• C:\\Windows\n\n"; Constructed_Msg += Translations.Database("Program_TextBox_Folder_Check_Launcher_P5") + "\n"; Constructed_Msg += "• 'C:\\Soapbox Race World' " + Translations.Database("Program_TextBox_Folder_Check_Launcher_P6") + " 'C:\\SBRW'\n"; Constructed_Msg += Translations.Database("Program_TextBox_Folder_Check_Launcher_P7") + "\n\n"; MessageBox.Show(null, Constructed_Msg, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error); FunctionStatus.LauncherForceClose = true; break; } Log.Completed("FOLDER LOCATION: Done"); } if (FunctionStatus.LauncherForceClose) { FunctionStatus.ErrorCloseLauncher("Closing From Invalid Launcher Location", false); } else { Log.Checking("WRITE TEST: Launcher Folder Test"); if (!FunctionStatus.HasWriteAccessToFolder(Locations.LauncherFolder)) { MessageBox.Show(Translations.Database("Program_TextBox_Folder_Write_Test")); } Log.Completed("WRITE TEST: Passed"); Log.Checking("INI FILES: Doing Nullsafe"); DiscordLauncherPresence.Status("Start Up", "Doing NullSafe ini Files"); FileSettingsSave.NullSafeSettings(); FileAccountSave.NullSafeAccount(); Log.Completed("INI FILES: Done"); /* Sets up Theming */ Theming.CheckIfThemeExists(); Log.Function("APPLICATION: Setting Language"); CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo(Translations.UI(Translations.Application_Language = FileSettingsSave.Lang.ToLower(), true)); Log.Completed("APPLICATION: Done Setting Language '" + Translations.UI(Translations.Application_Language) + "'"); /* Windows 7 TLS Check */ if (WindowsProductVersion.GetWindowsNumber() == 6.1) { Log.Checking("SSL/TLS: Windows 7 Detected"); DiscordLauncherPresence.Status("Start Up", "Checking Windows 7 SSL/TLS"); try { String MessageBoxPopupTLS = String.Empty; string keyName = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client"; string subKey = "DisabledByDefault"; if (Registry.GetValue(keyName, subKey, null) == null) { MessageBoxPopupTLS = Translations.Database("Program_TextBox_W7_TLS_P1") + "\n\n"; MessageBoxPopupTLS += "- HKLM/SYSTEM/CurrentControlSet/Control/SecurityProviders\n /SCHANNEL/Protocols/TLS 1.2/Client\n"; MessageBoxPopupTLS += "- Value: DisabledByDefault -> 0\n\n"; MessageBoxPopupTLS += Translations.Database("Program_TextBox_W7_TLS_P2") + "\n\n"; MessageBoxPopupTLS += Translations.Database("Program_TextBox_W7_TLS_P3"); /* There is only 'OK' Available because this IS Required */ if (MessageBox.Show(null, MessageBoxPopupTLS, "SBRW Launcher", MessageBoxButtons.OK, MessageBoxIcon.Warning) == DialogResult.OK) { RegistryCore.Write("DisabledByDefault", 0x0, @"SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client"); MessageBox.Show(null, Translations.Database("Program_TextBox_W7_TLS_P4"), "SBRW Launcher", MessageBoxButtons.OK, MessageBoxIcon.Information); } Log.Completed("SSL/TLS: Added Registry Key"); } else { Log.Completed("SSL/TLS: Done"); } } catch (Exception Error) { LogToFileAddons.OpenLog("SSL/TLS", null, Error, null, true); } } /* Windows 7 HotFix Check */ if (WindowsProductVersion.GetWindowsNumber() == 6.1 && string.IsNullOrWhiteSpace(FileSettingsSave.Win7UpdatePatches)) { Log.Checking("HotFixes: Windows 7 Detected"); DiscordLauncherPresence.Status("Start Up", "Checking Windows 7 HotFixes"); try { if (!ManagementSearcher.GetInstalledHotFix("KB3020369") || !ManagementSearcher.GetInstalledHotFix("KB3125574")) { String MessageBoxPopupKB = String.Empty; MessageBoxPopupKB = Translations.Database("Program_TextBox_W7_KB_P1") + "\n"; MessageBoxPopupKB += Translations.Database("Program_TextBox_W7_KB_P2") + "\n\n"; if (!ManagementSearcher.GetInstalledHotFix("KB3020369")) { MessageBoxPopupKB += "- " + Translations.Database("Program_TextBox_W7_KB_P3") + " KB3020369\n"; } if (!ManagementSearcher.GetInstalledHotFix("KB3125574")) { MessageBoxPopupKB += "- " + Translations.Database("Program_TextBox_W7_KB_P3") + " KB3125574\n"; } MessageBoxPopupKB += "\n" + Translations.Database("Program_TextBox_W7_KB_P4") + "\n"; if (MessageBox.Show(null, MessageBoxPopupKB, "SBRW Launcher", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { /* Since it's Informational we just need to know if they clicked 'OK' */ FileSettingsSave.Win7UpdatePatches = "1"; } else { /* or if they clicked 'Cancel' */ FileSettingsSave.Win7UpdatePatches = "0"; } FileSettingsSave.SaveSettings(); } Log.Completed("HotFixes: Done"); } catch (Exception Error) { LogToFileAddons.OpenLog("HotFixes", null, Error, null, true); } } } Log.Checking("JSON: Servers File"); try { if (File.Exists(Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameOldServersJSON)))) { if (File.Exists(Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameNewServersJSON)))) { File.Delete(Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameNewServersJSON))); } File.Move( Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameOldServersJSON)), Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameNewServersJSON))); Log.Completed("JSON: Renaming Servers File"); } else if (!File.Exists(Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameNewServersJSON)))) { try { File.WriteAllText( Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameNewServersJSON)), "[]"); Log.Completed("JSON: Created Servers File"); } catch (Exception Error) { LogToFileAddons.OpenLog("JSON SERVER FILE", null, Error, null, true); } } } catch (Exception Error) { LogToFileAddons.OpenLog("JSON SERVER FILE", null, Error, null, true); } Log.Checking("JSON: Done"); if (!string.IsNullOrWhiteSpace(FileSettingsSave.GameInstallation)) { Log.Checking("CLEANLINKS: Game Path"); if (File.Exists(Locations.GameLinksFile)) { ModNetHandler.CleanLinks(Locations.GameLinksFile, FileSettingsSave.GameInstallation); Log.Completed("CLEANLINKS: Done"); } else { Log.Completed("CLEANLINKS: Not Present"); } } Log.Checking("PROXY: Checking if Proxy Is Disabled from User Settings! It's value is " + FileSettingsSave.Proxy); if (FileSettingsSave.Proxy == "0") { Log.Core("PROXY: Starting Proxy (From Startup)"); ServerProxy.Instance.Start("Splash Screen [Program.cs]"); Log.Completed("PROXY: Started"); } else { Log.Completed("PROXY: Disabled"); } Log.Info("REDISTRIBUTABLE: Moved to Function"); /* (Starts Function Chain) Check if Redistributable Packages are Installed */ Redistributable.Check(); } } }
/// <summary> /// Constructor. /// </summary> /// <param name="reports">The list of reports to upload.</param> public BlackBoxUploadForm(IList <BlackBoxReport> reports) { InitializeComponent(); Theming.ApplyTheme(this); UploadWorker.RunWorkerAsync(reports); }
/// <summary> /// Constructor. /// </summary> public UpdateForm() { InitializeComponent(); Theming.ApplyTheme(this); updateListDownloader.RunWorkerAsync(); }