public UserOptions() { _opt = new DiversityUserOptions() { CurrentConnection = new ConnectionProfile() { InitialCatalog = "Init", IPAddress = "127.0.0.1", Port = "1234", Name = "Test", TaxonNamesInitialCatalog = "TaxaInit" }, Paths = new DBPaths(){ MobileDB = "Mob.sdf", MobileTaxa = "Tax.sdf", }, PasswordVisible = true, UseSqlAuthentification = false, Username = "******", UseDeviceDimensions = true, ScreenHeight = 800, ScreenWidth = 800, TruncateDataItems = false }; }
private void updateProfile() { _profile = null; if (Connections != null) { if (Settings != null && (_settings = Settings.getOptions()) != null) { if ((_mobileSerializer = Connections.MobileDB) != null) { MessengerInstance.Send<StatusNotification>("Services_UserProfile_SearchingProfile"); //Prüfen ob ein UserProfile zum LoginNamen existiert. IList<UserProfile> profiles = new List<UserProfile>(); IRestriction r = RestrictionFactory.Eq(typeof(UserProfile), "_LoginName", _settings.Username); //IRestriction r = RestrictionFactory.Eq(typeof(UserProfile), "_LoginName", "TestEditor"); profiles = _mobileSerializer.Connector.LoadList<UserProfile>(r); if (profiles.Count > 0) { _profile = profiles[0]; } else { MessengerInstance.Send<StatusNotification>("Services_UserProfile_CreatingNew"); _profile = createProfile(); } MessengerInstance.Send<StatusNotification>("Services_UserProfile_Loaded"); _operation.success(); } else _Log.Error("Mobile DB not connected"); } else _Log.Error("Settings N/A"); } else _Log.Error("Connections N/A"); _operation.failure("Services_UserProfile_Error_MissingConnectivitiy",""); }
public void setOptions(DiversityUserOptions o) { _opt = o; updateSubscribers(); }
private void updateProfiles() { if (CPService != null) { ConnectionProfiles = CPService.getAvailableProfiles(); SelectedProfile = 0; } ConnectionProfile currentProfile = null; if (UserOptions != null) { var currentOptions = UserOptions.getOptions(); if (currentOptions != null) { currentProfile = currentOptions.CurrentConnection; Options = currentOptions; } else Options = new DiversityUserOptions(); } if (ConnectionProfiles != null && currentProfile != null ) { var selectedIndices = from profile in ConnectionProfiles where profile.CompareTo(currentProfile) == 0 select ConnectionProfiles.IndexOf(profile); if (selectedIndices.Count() > 0) SelectedProfile = selectedIndices.First(); } }
private void updateFromSettings(DiversityUserOptions diversityUserOptions) { TruncateDataItems = diversityUserOptions.TruncateDataItems; }
public DiversityUserOptions getOptions() { if (_options == null) { if (File.Exists(_optionsPath)) { try { using (var xmlDoc = XmlReader.Create(new FileStream(_optionsPath, FileMode.Open))) { if (_serializer.CanDeserialize(xmlDoc)) _options = _serializer.Deserialize(xmlDoc) as DiversityUserOptions; } } catch (Exception ex) { _Log.ErrorFormat("Couldn't load existing UserOptions: [{0}]", ex); } } if (_options == null) _options = new DiversityUserOptions(); } return _options; }
public void setOptions(DiversityUserOptions o) { if (o == null) return; _options = o; updateSubscribers(); var openMode = File.Exists(_optionsPath) ? FileMode.Truncate : FileMode.Create; try { using (var fs = new FileStream(_optionsPath, openMode)) { _serializer.Serialize(fs, _options); } } catch (Exception ex) { _Log.ErrorFormat("Couldn't save UserOptions: [{0}]", ex); } }