private void LoadUserSettings() { Properties.Settings userSettings = new Properties.Settings(); // As user.config is writeable (if you can find it!) // don't want to trust the settings. bool firstrun = true; Point savedPosition = Point.Empty; int savedWidth = 0; MappingFilter oldFilter = MappingFilter.All; firstrun = (userSettings.UserHasSavedSettings == false); savedPosition = userSettings.KeyboardFormLocation; savedWidth = userSettings.KeyboardFormWidth; _hasNumberPad = userSettings.KeyboardFormHasNumberPad; _isMacKeyboard = userSettings.KeyboardFormHasMacKeyboard; oldFilter = (MappingFilter)userSettings.LastMappingsFilter; //if (firstrun == false) //{ // // AppController.SwitchKeyboardLayout((KeyboardLayoutType)userSettings.KeyboardLayout); //} if (firstrun || savedPosition.IsEmpty || savedPosition.X == -32000) { FormsManager.PositionMainForm(); } else { this.Location = savedPosition; } if (firstrun || savedWidth < this.MinimumSize.Width) { FormsManager.SizeMainForm(); } else { this.Width = savedWidth; } // If there are boot mappings and no user mappings and the last view mode was boot, then // start in boot mode - as long as user has the rights to change them (or is running Vista) if (oldFilter == MappingFilter.Boot && MappingsManager.GetMappingCount(MappingFilter.Boot) > 0 && MappingsManager.GetMappingCount(MappingFilter.User) == 0 && (AppController.UserCanWriteBootMappings || operatingSystemCapability.ImplementsUAC)) { MappingsManager.SetFilter(MappingFilter.Boot); } }
void SetMappingStatusLabelText() { int allmaps = MappingsManager.GetMappingCount(MappingFilter.All); int bootmaps = MappingsManager.GetMappingCount(MappingFilter.Boot); int usermaps = MappingsManager.GetMappingCount(MappingFilter.User); // TODO: Localizing issue. How to do plurals in other cultures??? string mapstatustext; if (allmaps > 0) { string bootmaptext = string.Empty; if (bootmaps != 0) { bootmaptext = operatingSystemCapability.SupportsUserMappings ? string.Format("{0} boot mapping{1}", bootmaps, (bootmaps != 1 ? "s" : "")) : string.Format("{0} mapping{1}", bootmaps, (bootmaps != 1 ? "s" : "")); } if (usermaps != 0) { string usermaptext = usermaps.ToString(CultureInfo.InvariantCulture.NumberFormat) + " user mapping" + (usermaps != 1 ? "s" : ""); mapstatustext = bootmaptext + (String.IsNullOrEmpty(bootmaptext) ? "" : ", ") + usermaptext; } else { mapstatustext = bootmaptext; } } else { // Need to have *something* on the status bar otherwise it doesn't work // properly in W2K (it doesn't show on startup) mapstatustext = "No mappings"; } StatusLabelMappings.Text = mapstatustext; }
private void SetMappingStatusLabelText() { int bootmaps = MappingsManager.GetMappingCount(MappingFilter.Boot); string mapstatustext; if (bootmaps != 0) { mapstatustext = string.Format("{0} mapping{1}", bootmaps, (bootmaps != 1 ? "s" : "")); } else { // Need to have *something* on the status bar otherwise it doesn't work // properly in W2K (it doesn't show on startup) mapstatustext = "No mappings"; } StatusLabelMappings.Text = mapstatustext; }