private void SaveOptions()
        {
#if !DEMO
            StoreSetting.Set("AutoUpdate",
                             (radioButtonAutoUpdateIsEnabled.IsSelected ? 1 : 0));
            LocalSetting.Values.String["UpdateServerPort"] = textBoxPort.Text;
            LocalSetting.Values.String["UpdateServer"]     = textBoxServer.Text;
            LocalSetting.Update();

            // Need to notify other clients of this information so they can update
            // their LocalSetting values
            BroadcastClientSocket.SendMessage("UpdateServerInfo " +
                                              LocalSetting.Values.String["UpdateServer"] + " " +
                                              LocalSetting.Values.String["UpdateServerPort"]);
#endif
        }
예제 #2
0
        private void DoStoreSettingCommand(string storeSettingCommand)
        {
            string[] tokens = storeSettingCommand.Split(' ');
            if (tokens.Length == 0)
            {
                PrintLine(Types.Strings.ShellHelpUsage);
                PrintHelpForStoreSettingCommand();
                return;
            }

            if (tokens.Length == 1)
            {
                PrintCurrentStoreSettingValue(tokens[0]);
                return;
            }

            bool   badUsage = false;
            string name     = tokens[0];
            string typeName = tokens[1];

            if (typeName.ToLower() == "int")
            {
                try
                {
                    int?value = null;
                    if (tokens[2] != "null")
                    {
                        value = Convert.ToInt32(tokens[2]);
                    }
                    StoreSetting.Set(name, value);
                }
                catch
                {
                    badUsage = true;
                }
            }
            else if (typeName.ToLower() == "string")
            {
                try
                {
                    if (tokens[2] != "null")
                    {
                        StoreSetting.Set(name, storeSettingCommand.Substring(8 + name.Length));
                    }
                    else
                    {
                        StoreSetting.Set(name, (string)null);
                    }
                }
                catch
                {
                    badUsage = true;
                }
            }
            else if (typeName.ToLower() == "double")
            {
                try
                {
                    double?value = null;
                    if (tokens[2] != "null")
                    {
                        value = Convert.ToDouble(tokens[2]);
                    }
                    StoreSetting.Set(name, value);
                }
                catch
                {
                    badUsage = true;
                }
            }
            else if (typeName.ToLower() == "datetime")
            {
                try
                {
                    DateTime?value = null;
                    if (tokens[2] != "null")
                    {
                        value = Convert.ToDateTime(tokens[2]);
                    }
                    StoreSetting.Set(name, value);
                }
                catch
                {
                    badUsage = true;
                }
            }

            if (badUsage)
            {
                PrintLine(Types.Strings.ShellHelpUsage);
                PrintHelpForStoreSettingCommand();
            }
        }
예제 #3
0
 public static void SetStoreSetting(string settingName, DateTime?dateTimeValue)
 {
     StoreSetting.Set(settingName, dateTimeValue);
     StoreSetting managed = GetUpdatedManagedStoreSetting(StoreSetting.Get(settingName));
 }