コード例 #1
0
        public ChildObjectViewModel(
            TreeViewViewModel treeParent,
            CompoundObjectViewModel parentVm,
            MainViewModel mainVm,
            ChildObject modelObject,
            bool enabled = true) :
            base(treeParent, parentVm, mainVm, enabled)
        {
            ModelObject = modelObject;

            foreach (TStateProperties <ChildObjectStateProperties> cosp in ModelObject.StateProperties)
            {
                ChildCOViewModel cospvm = new ChildCOViewModel(this, parentVm, mainVm, cosp, enabled);
                StateProperties.Add(cospvm);

                // Since this COVM is the child of another COVM we need to check if the COVM
                // is a reference to a file or not. If it is, the children of the COVM shall
                // not be selectable, i.e. they shall be disabled. If it it is not a file ref
                // it shall be selectable.
                if (cospvm.IsFileReferenceChild)
                {
                    cospvm.BuildViewModel(false);
                }
                else
                {
                    cospvm.BuildViewModel(true);
                }
            }
        }
コード例 #2
0
ファイル: StateRow.cs プロジェクト: PLS54/CSharpCode
 /// <summary>
 /// Begins an edit on a StateRow.
 /// </summary>
 public void BeginEdit()
 {
     if (!isEditing)
     {
         backupState = state;
         isEditing   = true;
     }
 }
コード例 #3
0
ファイル: StateRow.cs プロジェクト: PLS54/CSharpCode
 /// <summary>
 /// Pushes changes since the last BeginEdit or IBindingList.AddNew call
 /// into the underlying StateRow.
 /// </summary>
 public void EndEdit()
 {
     if (isEditing)
     {
         backupState = new StateProperties();
         isEditing   = false;
         isNew       = false;
     }
 }
コード例 #4
0
        /// <summary>Retrieves the <see cref="StatePropertyDefinition"/> with the passed name.</summary>
        /// <param name="propertyName">Name of the <see cref="StatePropertyDefinition"/> to retrieve.Must not be <see langword="null" /> or empty. </param>
        /// <exception cref="ArgumentException">Thrown if the specified property does not exist on this <see cref="SecurableClassDefinition"/>.</exception>
        public StatePropertyDefinition GetStateProperty(string propertyName)
        {
            ArgumentUtility.CheckNotNullOrEmpty("propertyName", propertyName);

            return(StateProperties.Single(
                       p => p.Name == propertyName,
                       () => CreateArgumentException(
                           "propertyName",
                           "A state property with the name '{0}' is not defined for the secureable class definition '{1}'.",
                           propertyName,
                           Name)));
        }
コード例 #5
0
        internal override void PollForStateAndUpdate()
        {
            string currentSelectedItemId = (string)StateProperties[ComboBoxCommandProperties.SelectedItemId];

            // If we currently don't have an item set, then we set it here to let the application know
            // since this is what we'll fall back to unless they set something else.
            if (string.IsNullOrEmpty(currentSelectedItemId))
            {
                StateProperties[ComboBoxCommandProperties.SelectedItemId] = CBProperties.InitialItem;
            }

            bool succeeded = PollForStateAndUpdateInternal(CBProperties.Command,
                                                           CBProperties.QueryCommand,
                                                           StateProperties,
                                                           false);

            string newSelectedItemId = StateProperties[ComboBoxCommandProperties.SelectedItemId];

            if (succeeded)
            {
                if (IsFreeForm)
                {
                    _elmMediumInput.Value = StateProperties[ComboBoxCommandProperties.Value];
                    StateProperties[ComboBoxCommandProperties.SelectedItemId] = "";
                }
                else
                {
                    // If the currently selected item is null, use the display text
                    if (!string.IsNullOrEmpty(currentSelectedItemId))
                    {
                        // If the selected item id has changed or if one has never been selected
                        // then we want to select it.
                        if (currentSelectedItemId != newSelectedItemId || !_itemEverSelected)
                        {
                            if (!SelectMenuItemById(newSelectedItemId))
                            {
                                throw new InvalidOperationException("The menu item id requested via polling does not exist");
                            }
                        }
                    }
                    else
                    {
                        string valueKey = ComboBoxCommandProperties.Value;
                        string medValue = StateProperties.ContainsKey(valueKey) ? StateProperties[valueKey] : "";
                        if (!string.IsNullOrEmpty(medValue))
                        {
                            _elmMediumInput.Value = StateProperties[ComboBoxCommandProperties.Value];
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: StateRow.cs プロジェクト: PLS54/CSharpCode
        /// <summary>
        /// Discards changes since the last BeginEdit call.
        /// </summary>
        public void CancelEdit()
        {
            if (isEditing)
            {
                state     = backupState;
                isEditing = false;

                if (isNew)
                {
                    OnEditCancelled();
                }
            }
        }
コード例 #7
0
ファイル: dropdown.cs プロジェクト: tralivali1234/IL2JS
        internal override void PollForStateAndUpdate()
        {
            string itemKey = DropDownCommandProperties.SelectedItemId;
            string currentSelectedItemId = StateProperties.ContainsKey(itemKey) ? StateProperties[itemKey] : "";

            // If we currently don't have an item set, then we set it here to let the application know
            // since this is what we'll fall back to unless they set something else.
            if (string.IsNullOrEmpty(currentSelectedItemId))
            {
                StateProperties[DropDownCommandProperties.SelectedItemId] = Properties.InitialItem;
            }

            PollForStateAndUpdateInternal(Properties.Command,
                                          Properties.QueryCommand,
                                          StateProperties,
                                          false);

            string newSelectedItemId = StateProperties[DropDownCommandProperties.SelectedItemId];

            // If the currently selected item is null, use the display text
            if (!string.IsNullOrEmpty(newSelectedItemId))
            {
                // We want to select the item if it is different than the one that we currently
                // have or if we have never selected one (this happens when
                if (currentSelectedItemId != newSelectedItemId || !_itemEverSelected)
                {
                    if (!SelectMenuItemById(newSelectedItemId))
                    {
                        throw new InvalidOperationException("The menu item id requested via polling does not exist");
                    }
                }
            }
            else
            {
                string valueKey = DropDownCommandProperties.Value;
                string title    = StateProperties.ContainsKey(valueKey) ? StateProperties[valueKey] : "";
                if (!string.IsNullOrEmpty(title))
                {
                    // O14:330988 Put it in an <a> tag so it picks up the correct style.
                    Anchor newAnchor = new Anchor();
                    newAnchor.InnerHtml = title;
                    _elmMediumSelectedItem.AppendChild(newAnchor);
                }
            }
        }
コード例 #8
0
ファイル: dropdown.cs プロジェクト: tralivali1234/IL2JS
        public override void OnBeginFocus()
        {
            string dictKey           = DropDownCommandProperties.Value;
            string selectedItemTitle = StateProperties.ContainsKey(dictKey) ? StateProperties[dictKey] : "";

            if (string.IsNullOrEmpty(selectedItemTitle))
            {
                // get currently selected item ID
                string itemKey = DropDownCommandProperties.SelectedItemId;
                string currentSelectedItemId = StateProperties.ContainsKey(itemKey) ? StateProperties[itemKey] : "";

                // If we currently don't have an item set, then we set it here to let the application know
                // since this is what we'll fall back to unless they set something else.
                if (string.IsNullOrEmpty(currentSelectedItemId))
                {
                    currentSelectedItemId = Properties.InitialItem;
                }

                // get the title of the selected item
                // The Menu can be null if this control's menu gets populated dynamically
                if ((!string.IsNullOrEmpty(currentSelectedItemId)) &&
                    (!CUIUtility.IsNullOrUndefined(Menu)))
                {
                    ISelectableControl isc = Menu.GetItemById(currentSelectedItemId);
                    if (!CUIUtility.IsNullOrUndefined(isc))
                    {
                        selectedItemTitle = isc.GetTextValue();
                    }
                }
            }
            if (!string.IsNullOrEmpty(selectedItemTitle))
            {
                Properties.ToolTipSelectedItemTitle = selectedItemTitle;
            }
            base.OnBeginFocus();
        }
コード例 #9
0
ファイル: dropdown.cs プロジェクト: tralivali1234/IL2JS
        protected override HtmlElement CreateDOMElementForDisplayMode(string displayMode)
        {
            string alt        = CUIUtility.SafeString(Properties.Alt);
            string altArrow   = CUIUtility.SafeString(Properties.AltArrow);
            bool   needsLabel = true;

            if (string.IsNullOrEmpty(altArrow) && !string.IsNullOrEmpty(Properties.ToolTipTitle))
            {
                altArrow = Properties.ToolTipTitle;
            }

            MSLabel elmHiddenLabel;

            switch (displayMode)
            {
            case "Text":     // Remove once project's ribbon doesn't use it anymore
            case "Medium":
                // Top Level Element
                _elmMedium           = new Span();
                _elmMedium.ClassName = "ms-cui-dd";
                _elmMedium.SetAttribute("mscui:controltype", ControlType);

                // Selected Item Element
                _elmMediumSelectedItem             = new Span();
                _elmMediumSelectedItem.ClassName   = "ms-cui-dd-text";
                _elmMediumSelectedItem.Style.Width = Properties.Width;

                string dictKey = DropDownCommandProperties.SelectedItemId;
                string itemId  = StateProperties.ContainsKey(dictKey) ? StateProperties[dictKey] : "";
                if (string.IsNullOrEmpty(itemId))
                {
                    itemId = Properties.InitialItem;
                }
                if (!string.IsNullOrEmpty(itemId))
                {
                    SelectMenuItemById(itemId);
                }

                // Arrow Button Element
                _elmMediumBtnA = new Anchor();
                _elmMediumBtnA.SetAttribute("role", AriaRole);
                _elmMediumBtnA.SetAttribute("aria-haspopup", "true");
                Utility.EnsureCSSClassOnElement(_elmMediumBtnA, "ms-cui-dd-arrow-button");
                Utility.SetAriaTooltipProperties(Properties, _elmMediumBtnA);
                Utility.NoOpLink(_elmMediumBtnA);
                _elmMediumBtnA.Id = Id;
                _elmMediumArwImg  = new Image();

                _elmMediumArwImgCont = Utility.CreateClusteredImageContainerNew(
                    ImgContainerSize.Size5by3,
                    Root.Properties.ImageDownArrow,
                    Root.Properties.ImageDownArrowClass,
                    _elmMediumArwImg,
                    true,
                    false,
                    Root.Properties.ImageDownArrowTop,
                    Root.Properties.ImageDownArrowLeft
                    );

                if (string.IsNullOrEmpty(Properties.ToolTipTitle))
                {
                    _elmMediumBtnA.SetAttribute("title", altArrow);
                    _elmMediumSelectedItem.Title = alt;
                    _elmMediumArwImg.Alt         = altArrow;
                    needsLabel = false;
                }

                // Set up event handlers for the Drop Down Arrow Button
                AttachEventsForDisplayMode("Medium");

                // Build DOM Structure
                _elmMedium.AppendChild(_elmMediumSelectedItem);
                _elmMedium.AppendChild(_elmMediumBtnA);
                _elmMediumBtnA.AppendChild(_elmMediumArwImgCont);

                if (needsLabel)
                {
                    elmHiddenLabel = Utility.CreateHiddenLabel(altArrow);
                    _elmMediumBtnA.AppendChild(elmHiddenLabel);
                }

                return(_elmMedium);

            default:
                EnsureValidDisplayMode(displayMode);
                return(null);
            }
        }
コード例 #10
0
 public override void WriteHtml(StateProperties properties, TextWriter writer)
 {
     // Allows a custom UI such as a button to be displayed in the form.
 }
コード例 #11
0
 public override bool UseStandardSave(StateProperties properties)
 {
     // Whether Infiniti should carry out its regular save routine when the user clicks save
     return(true);
 }
コード例 #12
0
 public override void ChangingPage(StateProperties properties, PageChangeArguments direction)
 {
     // Called each time the user navigates to a different page in the form. Either
     // forwards or backwards
     File.WriteAllText(@"c:\Temp\" + properties.Context.Wizard.WizardSession.Variables.RunId + ".xml", properties.GetAnswerFile());
 }
コード例 #13
0
 public override void AnswerFileSaving(StateProperties properties)
 {
     // Called when the user is saving an answer file in the form
     // properties.GetAnswerFile();
 }