private void DisplayPrompt(PreferenceType preferenceType, string title, string text, string checkText) { if (!preferences.GetSavePromptPreference(preferenceType)) { return; } PromptView prompt = Injector.GetInstance <PromptView>(); CheckBoxData checkData = new CheckBoxData(preferenceType, checkText); prompt.Initialize(title, text, new CheckBoxData[] { checkData }); bool?result = prompt.ShowDialog(); if (result == false) { args.CancelLoading(); } if (prompt.RememberChoice && prompt.GetChecked(preferenceType)) { preferences.SetPromptPreference(preferenceType, false); database.SavePromptSavePref(preferenceType, false); } }
/// <summary> /// Initializes a new instance of the <see cref="PreferenceRequest" /> class. /// </summary> /// <param name="preferenceId">The ID of the preference.</param> /// <param name="name">An alphanumeric English language name for this preference. Will be appended to a namespace to generate the full preference id. (required).</param> /// <param name="title">A short description for this preference. (required).</param> /// <param name="description">A long description for this preference..</param> /// <param name="_explicit">A flag describing whether this preference is explicit, or inline. (default to false).</param> /// <param name="required">A flag describing whether this property is required or not. (default to false).</param> /// <param name="preferenceType">preferenceType (required).</param> /// <param name="definition">definition (required).</param> public PreferenceRequest(string preferenceId = default(string), string name = default(string), string title = default(string), string description = default(string), bool _explicit = false, bool required = false, PreferenceType preferenceType = default(PreferenceType), PreferenceRequestDefinition definition = default(PreferenceRequestDefinition)) { // to ensure "name" is required (not null) if (name == null) { throw new ArgumentNullException("name is a required property for PreferenceRequest and cannot be null"); } this.Name = name; // to ensure "title" is required (not null) if (title == null) { throw new ArgumentNullException("title is a required property for PreferenceRequest and cannot be null"); } this.Title = title; this.PreferenceType = preferenceType; // to ensure "definition" is required (not null) if (definition == null) { throw new ArgumentNullException("definition is a required property for PreferenceRequest and cannot be null"); } this.Definition = definition; this.PreferenceId = preferenceId; this.Description = description; this.Explicit = _explicit; this.Required = required; }
private static string GetKey(string userName, string applicationKey, PreferenceType preferenceType) { if(preferenceType == PreferenceType.User) { return userName + '♦' + applicationKey; } return applicationKey; }
public int GetScore(PreferenceType type) { if (_type.Equals(type)) { return(_cursor); } return(0); }
public ModifyPlatformPreferenceEventArgs(ICoreService eventCoreInstance, string previousPreference, string modifiedPreference, IPlatformInfo platform, PreferenceType preferenceType) : base(eventCoreInstance) { this.Platform = platform; this.PreferenceType = preferenceType; this.PreviousPreference = previousPreference; this.ModifiedPreference = modifiedPreference; }
public void ApplicationPreferenceSave(string userName, string sessionGuid, string applicationKey, PreferenceType preferenceType, string xmlApplicationPreferenceDoc) { if (userName == null) throw new ArgumentNullException("userName"); if (sessionGuid == null) throw new ArgumentNullException("sessionGuid"); if (applicationKey == null) throw new ArgumentNullException("applicationKey"); if (xmlApplicationPreferenceDoc == null) throw new ArgumentNullException("xmlApplicationPreferenceDoc"); if (applicationKey.Length >= MaxKeySize) throw new ArgumentException("Too large", "applicationKey"); if (xmlApplicationPreferenceDoc.Length > SettingStorageSize) throw new ArgumentException("Too large", "xmlApplicationPreferenceDoc");//The Length property returns the number of Char objects in this instance, not the number of Unicode characters _applicationPreferenceProxy.Invoke(proxy => proxy.ApplicationPreferenceSave(userName, sessionGuid, applicationKey, PreferenceTypeMap[preferenceType], xmlApplicationPreferenceDoc)); }
internal void SavePromptSavePref(PreferenceType prefType, bool value) { using (SQLiteConnection db = new SQLiteConnection(dbArgs)) { db.Open(); NoQuery( $"UPDATE userPreferences SET value = {Convert.ToInt32(value)} WHERE type = {(int)prefType};" , db); db.Close(); } }
public void Randomize(List <PreferenceType> toAvoid, int favor = 0) // in case want to influence { _type = Utils.RandomEnumValue <PreferenceType>(toAvoid); if (favor != 0) { _cursor = Mathf.Clamp(favor, -1, 1); } else { _cursor = possibleValues[UnityEngine.Random.Range(0, possibleValues.Length)]; } }
public async Task <int> SaveUserPreference(PreferenceType preferenceType, string username, string bundle) { var context = Context as DwhDashboardContext; var preferences = context.UserPreferences.Where(x => x.UserName.ToLower() == username.ToLower()).ToList(); context.UserPreferences.RemoveRange(preferences); await context.SaveChangesAsync(); var userPreference = UserPreference.Create(username, preferenceType, bundle); context.UserPreferences.Attach(userPreference); return(await context.SaveChangesAsync()); }
/// <summary> /// Initializes a new instance of the <see cref="PreferenceResponse" /> class. /// </summary> /// <param name="preferenceId">The ID of the preference.</param> /// <param name="name">An alphanumeric English language name for this preference..</param> /// <param name="title">A short description for this preference. (required).</param> /// <param name="description">A long description for this preference..</param> /// <param name="required">A flag describing whether this property is required or not. (default to false).</param> /// <param name="preferenceType">preferenceType (required).</param> public PreferenceResponse(string preferenceId = default(string), string name = default(string), string title = default(string), string description = default(string), bool required = false, PreferenceType preferenceType = default(PreferenceType)) { // to ensure "title" is required (not null) if (title == null) { throw new ArgumentNullException("title is a required property for PreferenceResponse and cannot be null"); } this.Title = title; this.PreferenceType = preferenceType; this.PreferenceId = preferenceId; this.Name = name; this.Description = description; this.Required = required; }
private void import_Menu_Click(object sender, EventArgs e) { TypeListItem item = listView.SelectedObject as TypeListItem; //LogManager.AddLogMessage(Name, "import_Menu_Click", item.Name, LogManager.LogMessageType.DEBUG); if (item.Name != "Application") { PreferenceType type = (PreferenceType)Enum.Parse(typeof(PreferenceType), item.Name); ImportPreferences(type); } else { ImportPreferences(PreferenceType.None); } }
public void ApplicationPreferenceDelete(string userName, string sessionGuid, string applicationKey, PreferenceType preferenceType) { if (userName == null) throw new ArgumentNullException("userName"); if (sessionGuid == null) throw new ArgumentNullException("sessionGuid"); if (applicationKey == null) throw new ArgumentNullException("applicationKey"); if (applicationKey.Length >= MaxKeySize) throw new ArgumentException("Too large", "applicationKey"); try { _applicationPreferenceProxy.Invoke(proxy => proxy.ApplicationPreferenceDelete(userName, sessionGuid, applicationKey, PreferenceTypeMap[preferenceType])); } catch (ServiceOperationException e) { if (e.FaultCode != XmlRpcFaultCodes.ApplicationReferenceNotFound) throw; } }
/// <summary> /// Handles the event aggregator's <see cref="PreferenceChangedEvent"/> event. /// </summary> /// <param name="preferenceType">The type of preference that has changed.</param> public void OnPreferenceChanged(PreferenceType preferenceType) { switch (preferenceType) { case PreferenceType.Culture: OnCultureChanged(); this.OnPropertyChanged(_propertyNamesToNotifyOnCultureChange); break; case PreferenceType.SystemOfMeasurement: OnSystemOfMeasurementChanged(); this.OnPropertyChanged(_propertyNamesToNotifyOnSystemOfMeasurementChange); break; case PreferenceType.TemperatureMeasurementUnit: OnTemperatureMeasurementUnitChanged(); this.OnPropertyChanged(_propertyNamesToNotifyOnTemperatureMeasurementUnitChange); break; } }
public void LoadPreferences(UserPreferencesModel model) { using (SQLiteConnection db = new SQLiteConnection(dbArgs)) { db.Open(); using (SQLiteDataReader reader = new SQLiteCommand("SELECT * from userPreferences", db).ExecuteReader()) { while (reader.Read()) { PreferenceType prefType = (PreferenceType)reader.GetInt32(0); switch (prefType) { case PreferenceType.PROMPT_OUTSIDE_PLACEHOLDER: model.PromptOutsidePlaceholders = (OutsidePlaceholdersPrefType)reader.GetInt32(1); break; case PreferenceType.PROMPT_SAVE_PROFILE_LAYOUT_CHANGE: case PreferenceType.PROMPT_SAVE_PROFILE_APP_EXIT: case PreferenceType.PROMPT_APPLY_LAYOUT_LAYOUT_CHANGE: case PreferenceType.PROMPT_APPLY_LAYOUT_APP_EXIT: model.SetPromptPreference(prefType, Convert.ToBoolean(reader.GetInt32(1))); break; case PreferenceType.USER_WATCHED_PRESENTATION: model.UserWatchedPresentation = Convert.ToBoolean(reader.GetInt32(1)); break; case PreferenceType.LAST_PROFILE: model.LastProfileId = reader.GetInt32(1); break; case PreferenceType.USE_INVARIANT_CULTURE: model.UseInvariantCulture = Convert.ToBoolean(reader.GetInt32(1)); break; } } reader.Close(); } db.Close(); } }
public IEnumerable <UserPreference> GetUserPreferences(PreferenceType preferenceType, string username) { return(((DwhDashboardContext)Context).UserPreferences.Where( x => x.UserName.ToLower() == username.ToLower()).ToList()); }
public static UserPreference Create(string userName, PreferenceType preferenceType, string bundle) { return(new UserPreference(userName, preferenceType, bundle)); }
public bool GetChecked(PreferenceType prefType) { return(checkBoxes[prefType].IsChecked == true); }
public bool HasCkeck(PreferenceType prefType) { return(checkBoxes.ContainsKey(prefType)); }
private UserPreference(string userName, PreferenceType preferenceType, string bundle) { UserName = userName; PreferenceType = preferenceType; Bundle = bundle; }
public string ApplicationPreferenceRead(string userName, string sessionGuid, string applicationKey, PreferenceType preferenceType) { return _cache.RetrieveOrAdd(GetKey(userName, applicationKey, preferenceType), () => new StringTransferObject(_preferences.ApplicationPreferenceRead(userName, sessionGuid, applicationKey, preferenceType)), DateTimeOffset.UtcNow.AddDays(1)).Value; }
public CheckBoxData(PreferenceType prefType, string text) { PrefType = prefType; Text = text; }
public void ApplicationPreferenceDelete(string userName, string sessionGuid, string applicationKey, PreferenceType preferenceType) { _cache.Invalidate(GetKey(userName,applicationKey,preferenceType)); _preferences.ApplicationPreferenceDelete(userName, sessionGuid, applicationKey, preferenceType); }
public void UserInfoCreate(int userID, GenderType gender, PreferenceType preferenceType, short age, string pictureLocation, string status, string email, string handle, Converter converter, object dataObject) { using (DBAccess dbaccess = new DBAccess()) { SqlParameter parameter1 = new SqlParameter(); parameter1.ParameterName = "@UserID"; parameter1.Value = userID; parameter1.SqlDbType = SqlDbType.Int; SqlParameter parameter2 = new SqlParameter(); parameter2.ParameterName = "@Gender"; parameter2.Value = gender; parameter2.SqlDbType = SqlDbType.SmallInt; SqlParameter parameter3 = new SqlParameter(); parameter3.ParameterName = "@Preference"; parameter3.Value = preferenceType; parameter3.SqlDbType = SqlDbType.SmallInt; SqlParameter parameter4 = new SqlParameter(); parameter4.ParameterName = "@Age"; parameter4.Value = age; parameter4.SqlDbType = SqlDbType.SmallInt; //SqlParameter parameter5 = new SqlParameter(); //parameter5.ParameterName = "@PictureLocation"; //parameter5.Value = pictureLocation; //parameter5.SqlDbType = SqlDbType.VarChar; SqlParameter parameter6 = new SqlParameter(); parameter6.ParameterName = "@Status"; parameter6.Value = status; parameter6.SqlDbType = SqlDbType.SmallInt; SqlParameter parameter7 = new SqlParameter(); parameter7.ParameterName = "@Email"; parameter7.Value = email; parameter7.SqlDbType = SqlDbType.NVarChar; SqlParameter parameter8 = new SqlParameter(); parameter8.ParameterName = "@Handle"; parameter8.Value = handle; parameter8.SqlDbType = SqlDbType.VarChar; SqlParameter[] parameters = new SqlParameter[7] { parameter1, parameter2, parameter3, parameter4, parameter6, parameter7, parameter8 }; SqlDataReader reader = dbaccess.ExecuteProcedure("UserInfoCreate", this.connectionString, parameters); if (converter != null) { while (reader.Read()) { converter(reader, dataObject); } } } }
public void SetPromptPreference(PreferenceType prefType, bool value) { savePromptPreferences[prefType] = value; }
public void UserInfoCreate(int userID, GenderType gender, PreferenceType preferenceType, short age, string pictureLocation, string status, string email, string handle, Converter converter, object dataObject) { throw new NotImplementedException(); }
public void SaveValue(PreferenceType preferenceType, string value) { Preferences.Set(preferenceType.ToString(), value); }
public string GetValue(PreferenceType key) { return(Preferences.Get(key.ToString(), string.Empty)); }
public bool GetSavePromptPreference(PreferenceType prefType) { return(savePromptPreferences[prefType]); }