/// ------------------------------------------------------------------------------------ /// <summary> /// constructor for use with adding a new value (and stylesheet) /// </summary> /// <param name="persistProvider">The persist provider.</param> /// <param name="labels">The labels.</param> /// <param name="fieldName">the user-readable name of the field that is being edited</param> /// <param name="stylesheet">for getting right height for text</param> /// ------------------------------------------------------------------------------------ public ReallySimpleListChooser(IPersistenceProvider persistProvider, ObjectLabelCollection labels, string fieldName, IVwStylesheet stylesheet) { m_stylesheet = stylesheet; m_persistProvider = persistProvider; m_fieldName = fieldName; if (labels.Count > 0 && labels.IsFlatList()) m_fFlatList = true; InitializeComponent(); if (m_persistProvider != null) m_persistProvider.RestoreWindowSettings("SimpleListChooser", this); SetForDefaultExtras(); // It's easier to localize a format string than code that pieces together a string. this.Text = String.Format(XMLViewsStrings.ksChooseX, fieldName); LoadTree(labels, 0, false); InitHelp(); }
/// <summary> /// constructor for use with changing or setting multiple values. /// </summary> /// <param name="persistProvider">optional, if you want to preserve the size and /// location</param> /// <param name="labels"></param> /// <param name="fieldName">the user-readable name of the field that is being edited /// </param> /// <param name="cache"></param> /// <param name="rghvoChosen">use null or int[0] if empty</param> /// <param name="fSortLabels">if true, sort the labels alphabetically. if false, keep the order of given labels.</param> public ReallySimpleListChooser(IPersistenceProvider persistProvider, ObjectLabelCollection labels, string fieldName, FdoCache cache, int[] rghvoChosen, bool fSortLabels) : this(persistProvider, fieldName, cache, rghvoChosen) { if (labels.Count > 0 && labels.IsFlatList()) m_fFlatList = true; m_fSortLabels = fSortLabels; m_fSortLabelsSet = true; FinishConstructor(labels); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ReallySimpleListChooser"/> class. /// </summary> /// ----------------------------------------------------------------------------------- private void Init(FdoCache cache, IPersistenceProvider persistProvider, string fieldName, ObjectLabelCollection labels, int currentHvo,string nullLabel, IVwStylesheet stylesheet) { m_stylesheet = stylesheet; m_nullLabel.DisplayName = nullLabel; m_nullLabel.Cache = cache; m_cache = cache; m_persistProvider = persistProvider; m_fieldName = fieldName; if (labels.Count > 0 && labels.IsFlatList()) m_fFlatList = true; InitializeComponent(); if (m_persistProvider!= null) m_persistProvider.RestoreWindowSettings("SimpleListChooser", this); SetForDefaultExtras(); // It's easier to localize a format string than code that pieces together a string. this.Text = String.Format(XMLViewsStrings.ksChooseX, fieldName); LoadTree(labels, currentHvo, true); InitHelp(); }