Пример #1
0
 public NumberSliderData(IPopupControlCallback popupCallback, ConfigurationPlaceholder control)
 {
     this.popupCallback = popupCallback;
     this.control       = control;
     this.value         = double.Parse(this.popupCallback.GetValue(control).ToString(), (IFormatProvider)CultureInfo.InvariantCulture);
     this.pendingValue  = this.value;
 }
Пример #2
0
        private void GenerateContentFrom(ConfigurationPlaceholder control)
        {
            switch (control.ControlType)
            {
            case ConfigurationControlType.ComboBox:
                this.ConfigurationOptions.Add(this.GenerateComboBox(control));
                SampleDataConfigurationOption configurationOption = this.PopupCallback.GetValue(control) as SampleDataConfigurationOption;
                if (configurationOption == null)
                {
                    break;
                }
                using (IEnumerator <ConfigurationPlaceholder> enumerator = configurationOption.ChildControls.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        this.GenerateContentFrom(enumerator.Current);
                    }
                    break;
                }

            case ConfigurationControlType.NumberSlider:
                this.ConfigurationOptions.Add(this.GenerateSlider(control));
                break;

            case ConfigurationControlType.DirectoryBrowser:
                this.ConfigurationOptions.Add(this.GenerateFileBrowser(control));
                break;
            }
        }
Пример #3
0
 public object GetConfigurationValue(ConfigurationPlaceholder placeholder)
 {
     if (placeholder == ConfigurationPlaceholder.StringFormat)
     {
         if (this.useLatin)
         {
             return((object)SampleDataConfigurationOption.StringFormatRandomLatin);
         }
         foreach (SampleDataConfigurationOption configurationOption in (IEnumerable <SampleDataConfigurationOption>)SampleDataConfigurationOption.StringFormatCustom)
         {
             if (this.format == configurationOption.StringValue)
             {
                 return((object)configurationOption);
             }
         }
     }
     else
     {
         if (placeholder == ConfigurationPlaceholder.RandomLatinWordCount)
         {
             return((object)this.latinWordCount);
         }
         if (placeholder == ConfigurationPlaceholder.RandomLatinWordLength)
         {
             return((object)this.latinWordLength);
         }
     }
     return((object)null);
 }
Пример #4
0
        public FileBrowserData(IPopupControlCallback popupCallback, ConfigurationPlaceholder control)
        {
            this.popupCallback = popupCallback;
            this.control       = control;
            object obj = this.popupCallback.GetValue(control);

            this.DirectoryDisplayText = obj != null?obj.ToString() : (string)null;
        }
Пример #5
0
 public object GetConfigurationValue(ConfigurationPlaceholder placeholder)
 {
     if (placeholder == ConfigurationPlaceholder.NumberLength)
     {
         return((object)this.numberLength);
     }
     return((object)null);
 }
 public object GetConfigurationValue(ConfigurationPlaceholder placeholder)
 {
     if (placeholder == ConfigurationPlaceholder.ImageFolderBrowser)
     {
         return((object)this.imageDirectory);
     }
     return((object)null);
 }
Пример #7
0
 public void SetConfigurationValue(ConfigurationPlaceholder placeholder, object value)
 {
     if (placeholder == ConfigurationPlaceholder.StringFormat)
     {
         string str1 = value == null ? string.Empty : value.ToString();
         if (str1 == SampleDataConfigurationOption.StringFormatRandomLatin.StringValue)
         {
             this.format   = str1;
             this.useLatin = true;
         }
         else
         {
             if (string.IsNullOrEmpty(str1))
             {
                 return;
             }
             foreach (string str2 in SampleFormatValues.Instance.Columns)
             {
                 if (str2.ToUpperInvariant() == str1.ToUpperInvariant())
                 {
                     this.format   = str2;
                     this.useLatin = false;
                     break;
                 }
             }
         }
     }
     else if (placeholder == ConfigurationPlaceholder.RandomLatinWordCount)
     {
         int result;
         if (!int.TryParse(value.ToString(), out result))
         {
             return;
         }
         this.latinWordCount   = result;
         this.formatParameters = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0},{1}", new object[2]
         {
             (object)this.latinWordCount,
             (object)this.latinWordLength
         });
     }
     else
     {
         int result;
         if (placeholder != ConfigurationPlaceholder.RandomLatinWordLength || !int.TryParse(value.ToString(), out result))
         {
             return;
         }
         this.latinWordLength  = result;
         this.formatParameters = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0},{1}", new object[2]
         {
             (object)this.latinWordCount,
             (object)this.latinWordLength
         });
     }
 }
Пример #8
0
 public void SetValue(ConfigurationPlaceholder control, object value)
 {
     if (control != ConfigurationPlaceholder.RandomLatinWordCount && control != ConfigurationPlaceholder.RandomLatinWordLength && control != ConfigurationPlaceholder.StringFormat)
     {
         return;
     }
     this.stringConfigurator.SetConfigurationValue(control, value);
     using (TemporaryCursor.SetWaitCursor())
         DesignDataGenerator.UpdateDesignValues(this.designDataFile, this.property, (ISampleTypeConfiguration)this.stringConfigurator);
 }
Пример #9
0
 public object GetValue(ConfigurationPlaceholder control)
 {
     if (control == ConfigurationPlaceholder.Type)
     {
         return((object)SampleDataConfigurationOption.TypeString);
     }
     if (control == ConfigurationPlaceholder.RandomLatinWordCount || control == ConfigurationPlaceholder.RandomLatinWordLength || control == ConfigurationPlaceholder.StringFormat)
     {
         return(this.stringConfigurator.GetConfigurationValue(control));
     }
     return((object)null);
 }
Пример #10
0
        public void SetConfigurationValue(ConfigurationPlaceholder placeholder, object value)
        {
            string absolutePath = this.GetAbsolutePath(value == null ? string.Empty : value.ToString());

            if (string.IsNullOrEmpty(absolutePath) || !Microsoft.Expression.Framework.Documents.PathHelper.DirectoryExists(absolutePath) || !(this.imageDirectory != absolutePath))
            {
                return;
            }
            this.imageDirectory = absolutePath;
            this.imageFiles     = (List <string>)null;
            this.index          = -1;
        }
Пример #11
0
        protected DataConfigurationPopup(IPopupControlCallback popupCallback, ConfigurationPlaceholder rootConfig)
        {
            this.rootConfig = rootConfig;
            FrameworkElement element = FileTable.GetElement("Resources\\DataPane\\ConfigureSampleDataPopup.xaml");

            this.Child                = (UIElement)element;
            element.DataContext       = (object)this;
            this.Focusable            = true;
            this.PopupCallback        = popupCallback;
            this.ConfigurationOptions = new ObservableCollection <IConfigurationOptionData>();
            this.GenerateContent();
        }
 public void SetValue(ConfigurationPlaceholder control, object value)
 {
     this.configuration.SetConfigurationValue(control, value);
     using (TemporaryCursor.SetWaitCursor())
     {
         this.property.ChangeTypeAndFormat((SampleType)this.configuration.SampleType, this.configuration.Format, this.configuration.FormatParameters);
         if (this.property.PropertySampleType == SampleBasicType.Image)
         {
             this.property.DeclaringDataSet.EnsureSampleImages();
         }
         this.property.DeclaringDataSet.CommitChanges(this.messageService);
     }
 }
Пример #13
0
 public void SetConfigurationValue(ConfigurationPlaceholder placeholder, object value)
 {
     this.sampleDataProperty.SampleTypeConfiguration.SetConfigurationValue(placeholder, value);
     this.sampleDataProperty.UpdateSampleProperty();
     if (placeholder != ConfigurationPlaceholder.Type)
     {
         return;
     }
     if (this.PropertyChanged != null)
     {
         this.PropertyChanged((object)this, new PropertyChangedEventArgs("ButtonTypeIcon"));
         this.PropertyChanged((object)this, new PropertyChangedEventArgs("ButtonTypeIconMouseOver"));
     }
     this.SetTemplateForColumn();
 }
Пример #14
0
        public void SetConfigurationValue(ConfigurationPlaceholder placeholder, object value)
        {
            double result = double.NaN;

            if (value is double)
            {
                result = (double)value;
            }
            else
            {
                double.TryParse(value as string, NumberStyles.Any, (IFormatProvider)CultureInfo.InvariantCulture, out result);
            }
            if (double.IsNaN(result) || double.IsInfinity(result) || (result <= 0.0 || result > 10.0))
            {
                return;
            }
            this.numberLength = (int)result;
        }
Пример #15
0
 public object GetConfigurationValue(ConfigurationPlaceholder placeholder)
 {
     if (placeholder == ConfigurationPlaceholder.Type)
     {
         return((object)this.activeType);
     }
     if (placeholder == ConfigurationPlaceholder.NumberLength)
     {
         return(this.NumberValueGenerator.GetConfigurationValue(placeholder));
     }
     if (placeholder == ConfigurationPlaceholder.ImageFolderBrowser)
     {
         return(this.ImageValueGenerator.GetConfigurationValue(placeholder));
     }
     if (placeholder == ConfigurationPlaceholder.RandomLatinWordCount || placeholder == ConfigurationPlaceholder.RandomLatinWordLength || placeholder == ConfigurationPlaceholder.StringFormat)
     {
         return(this.StringValueGenerator.GetConfigurationValue(placeholder));
     }
     return((object)null);
 }
Пример #16
0
 public object GetSelectedValue(ConfigurationPlaceholder placeholder)
 {
     if (placeholder == ConfigurationPlaceholder.Type)
     {
         if (this.activeType == SampleBasicType.Boolean)
         {
             return((object)SampleDataConfigurationOption.TypeBoolean);
         }
         if (this.activeType == SampleBasicType.Image)
         {
             return((object)SampleDataConfigurationOption.TypeImage);
         }
         if (this.activeType == SampleBasicType.Number)
         {
             return((object)SampleDataConfigurationOption.TypeNumber);
         }
         if (this.activeType == SampleBasicType.String)
         {
             return((object)SampleDataConfigurationOption.TypeString);
         }
     }
     else
     {
         if (placeholder == ConfigurationPlaceholder.NumberLength)
         {
             return(this.NumberValueGenerator.GetConfigurationValue(placeholder));
         }
         if (placeholder == ConfigurationPlaceholder.ImageFolderBrowser)
         {
             return(this.ImageValueGenerator.GetConfigurationValue(placeholder));
         }
         if (placeholder == ConfigurationPlaceholder.RandomLatinWordCount || placeholder == ConfigurationPlaceholder.RandomLatinWordLength || placeholder == ConfigurationPlaceholder.StringFormat)
         {
             return(this.StringValueGenerator.GetConfigurationValue(placeholder));
         }
     }
     return((object)null);
 }
Пример #17
0
 public void SetConfigurationValue(ConfigurationPlaceholder placeholder, object value)
 {
     if (placeholder == ConfigurationPlaceholder.Type)
     {
         this.activeType = (SampleBasicType)((SampleDataConfigurationOption)value).Value;
     }
     else if (placeholder == ConfigurationPlaceholder.NumberLength)
     {
         this.NumberValueGenerator.SetConfigurationValue(placeholder, value);
     }
     else if (placeholder == ConfigurationPlaceholder.ImageFolderBrowser)
     {
         this.ImageValueGenerator.SetConfigurationValue(placeholder, value);
     }
     else
     {
         if (placeholder != ConfigurationPlaceholder.RandomLatinWordCount && placeholder != ConfigurationPlaceholder.RandomLatinWordLength && placeholder != ConfigurationPlaceholder.StringFormat)
         {
             return;
         }
         this.StringValueGenerator.SetConfigurationValue(placeholder, value);
     }
 }
Пример #18
0
 private IConfigurationOptionData GenerateComboBox(ConfigurationPlaceholder control)
 {
     return((IConfigurationOptionData) new ComboBoxData(this.PopupCallback, control, this));
 }
Пример #19
0
 public ComboBoxData(IPopupControlCallback popupCallback, ConfigurationPlaceholder control, DataConfigurationPopup popup)
 {
     this.PopupCallback = popupCallback;
     this.Control       = control;
     this.Popup         = popup;
 }
 public object GetConfigurationValue(ConfigurationPlaceholder placeholder)
 {
     return((object)null);
 }
Пример #21
0
 private IConfigurationOptionData GenerateSlider(ConfigurationPlaceholder control)
 {
     return((IConfigurationOptionData) new NumberSliderData(this.PopupCallback, control));
 }
 public object GetValue(ConfigurationPlaceholder control)
 {
     return(this.column.SampleDataProperty.SampleTypeConfiguration.GetSelectedValue(control));
 }
 public void SetValue(ConfigurationPlaceholder control, object value)
 {
     this.column.SetConfigurationValue(control, value);
 }
 public object GetValue(ConfigurationPlaceholder control)
 {
     return(this.configuration.GetSelectedValue(control));
 }
 public void SetConfigurationValue(ConfigurationPlaceholder placeholder, object value)
 {
 }
Пример #26
0
 private IConfigurationOptionData GenerateFileBrowser(ConfigurationPlaceholder control)
 {
     return((IConfigurationOptionData) new FileBrowserData(this.PopupCallback, control));
 }