Exemplo n.º 1
0
 private void Settings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Filial")
     {
         Филиал = new FuncParameter("f", Properties.Settings.Default.Filial);
     }
 }
Exemplo n.º 2
0
        public BaseFuncViewModel()
        {
            GetCommand = new AsynchronousDelegateCommand(
                (param) =>
            {
                Execute(param);
            },
                (p) => CanExecute(p),
                GetCommandHeader);

            Отладка = new FuncParameter("debug", "1");

            Филиал = new FuncParameter("f", Properties.Settings.Default.Filial);

            Properties.Settings.Default.PropertyChanged += Settings_PropertyChanged;
        }
Exemplo n.º 3
0
        private string GetString(PropertyInfo[] propertyInfos, bool escapeValues = false, bool withOutFilial = true)
        {
            StringBuilder sb = new StringBuilder();

            foreach (PropertyInfo info in propertyInfos)
            {
                string name;
                string value;
                if (info.PropertyType == typeof(FuncParameter))
                {
                    FuncParameter param = (FuncParameter)info.GetValue(this, null);
                    if (withOutFilial && param.Name == "f")
                    {
                        continue;
                    }
                    name  = param.Name;
                    value = param.Value;
                }
                else
                {
                    name  = info.Name;
                    value = info.GetValue(this, null).ToString();
                }

                if (value != null && String.IsNullOrEmpty(value) == false)
                {
                    if (escapeValues)
                    {
                        sb.AppendFormat("&{0}={1}", name, EcapeString(value));
                    }
                    else
                    {
                        sb.AppendFormat("&{0}={1}", name, value);
                    }
                }
            }
            string result = sb.ToString();

            if (result.StartsWith("&"))
            {
                return(result.Remove(0, 1));
            }
            else
            {
                return(result);
            }
        }