Example #1
0
        static string ExpandVars(string str, Arguments args, ExpandMode mode)
        {
            string tag;

            switch (mode)
            {
            case ExpandMode.Default:
                tag = "${0}";
                break;

            case ExpandMode.Tag:
                tag = "<%{0}%>";
                break;

            default:
                throw new ArgumentOutOfRangeException("mode");
            }

            string[][] vars =
            {
                new[] { "name", args.Name },
                new[] { "guid", args.Guid }
            };

            foreach (var v in vars)
            {
                var regex = new Regex(StringToRegex(string.Format(tag, v[0])), RegexOptions.IgnoreCase);
                str = regex.Replace(str, v[1]);
            }

            return(str);
        }
Example #2
0
        public void CalculateExpandMode()
        {
            if (m_ExpandMode == ExpandMode.AutoRadial)
            {
                Vector2 baseMin = new Vector2(
                    m_BaseRectTransform.GetPositionRegardlessOfPivot().x - m_BaseRectTransform.sizeDelta.x / 2f,
                    m_BaseRectTransform.GetPositionRegardlessOfPivot().y - m_BaseRectTransform.sizeDelta.y / 2f);
                Vector2 baseMax = new Vector2(
                    m_BaseRectTransform.GetPositionRegardlessOfPivot().x + m_BaseRectTransform.sizeDelta.x / 2f,
                    m_BaseRectTransform.GetPositionRegardlessOfPivot().y + m_BaseRectTransform.sizeDelta.y / 2f);

                Vector2 expandedMin = new Vector2(m_ExpandedPosition.x - m_ExpandedSize.x / 2f, m_ExpandedPosition.y - m_ExpandedSize.y / 2f);
                Vector2 expandedMax = new Vector2(m_ExpandedPosition.x + m_ExpandedSize.x / 2f, m_ExpandedPosition.y + m_ExpandedSize.y / 2f);

                if ((expandedMin.x <= baseMin.x) && (expandedMin.y <= baseMin.y) && (expandedMax.x >= baseMax.x) &&
                    (expandedMax.y >= baseMax.y))
                {
                    m_FinalExpandMode = ExpandMode.Radial;
                }
                else
                {
                    m_FinalExpandMode = ExpandMode.Hybrid;
                }
            }
            else
            {
                m_FinalExpandMode = m_ExpandMode;
            }
        }
Example #3
0
        public static IQueryable <TSource> Expand <TSource, TProperty>(this IQueryable <TSource> source,
                                                                       Expression <Func <TSource, TProperty> >
                                                                       propertySelector,
                                                                       ExpandMode expandMode)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (propertySelector == null)
            {
                throw new ArgumentNullException(nameof(propertySelector));
            }

            switch (expandMode)
            {
            case ExpandMode.Default:
                return(source);

            case ExpandMode.Full:
                return(source.Expand(propertySelector));

            case ExpandMode.Shallow:
                return(source.ExpandShallow(propertySelector));

            default:
                throw new PomonaException("ExpandMode " + expandMode + "not recognized.");
            }
        }
Example #4
0
 private void OnExpandModeChanged(ExpandMode mode)
 {
     if (mode == ExpandMode.ShowAll)
     {
         ShowAll();
     }
     else if (mode == ExpandMode.ShowOne)
     {
         var sideMenuItem = ItemsHost.Children.OfType <SideMenuItem>().FirstOrDefault(item => item.IsSelected);
         ShowSelectedOne(sideMenuItem);
     }
 }
 public StructuredPropertyDetails(bool isAttributesProperty,
                                  bool isEtagProperty,
                                  bool isPrimaryKey,
                                  bool isSerialized,
                                  HttpMethod accessMode,
                                  HttpMethod itemAccessMode,
                                  ExpandMode expandMode)
 {
     IsAttributesProperty = isAttributesProperty;
     IsEtagProperty       = isEtagProperty;
     IsPrimaryKey         = isPrimaryKey;
     IsSerialized         = isSerialized;
     AccessMode           = accessMode;
     ItemAccessMode       = itemAccessMode;
     ExpandMode           = expandMode;
 }
 public StructuredPropertyDetails(bool isAttributesProperty,
                                  bool isEtagProperty,
                                  bool isPrimaryKey,
                                  bool isSerialized,
                                  HttpMethod accessMode,
                                  HttpMethod itemAccessMode,
                                  ExpandMode expandMode)
 {
     IsAttributesProperty = isAttributesProperty;
     IsEtagProperty = isEtagProperty;
     IsPrimaryKey = isPrimaryKey;
     IsSerialized = isSerialized;
     AccessMode = accessMode;
     ItemAccessMode = itemAccessMode;
     ExpandMode = expandMode;
 }
Example #7
0
        private void OnExpandModeChanged(ExpandMode mode)
        {
            if (mode == ExpandMode.ShowAll)
            {
                ShowAll();
            }
            else if (mode == ExpandMode.ShowOne)
            {
                SideMenuItem sideMenuItemSelected = null;
                foreach (var sideMenuItem in ItemsHost.Children.OfType <SideMenuItem>())
                {
                    if (sideMenuItemSelected != null)
                    {
                        sideMenuItem.IsSelected = false;
                        if (sideMenuItem.ItemsHost != null)
                        {
                            foreach (var sideMenuSubItem in sideMenuItem.ItemsHost.Children.OfType <SideMenuItem>())
                            {
                                sideMenuSubItem.IsSelected = false;
                            }
                        }
                    }
                    else if (sideMenuItem.IsSelected)
                    {
                        ShowSelectedOne(sideMenuItem);
                        sideMenuItemSelected = sideMenuItem;

                        if (sideMenuItem.ItemsHost != null)
                        {
                            foreach (var sideMenuSubItem in sideMenuItem.ItemsHost.Children.OfType <SideMenuItem>())
                            {
                                if (_selectedItem != null)
                                {
                                    sideMenuSubItem.IsSelected = false;
                                }
                                else if (sideMenuSubItem.IsSelected)
                                {
                                    _selectedItem = sideMenuSubItem;
                                }
                            }
                        }
                    }
                }
            }
        }
 public static void SetExpandMode(DependencyObject obj, ExpandMode value)
 {
     obj.SetValue(ExpandModeProperty, value);
 }
 private void Control_TextChanged(object sender, EventArgs e)
 {
     ExpandMode currentExpand = this.CurrentExpand;
     this.CurrentExpand = ExpandMode.None;
     if (currentExpand != ExpandMode.None)
     {
         Control control = (Control) sender;
         bool flag = true;
         IEnumerable<object> source = this.ExpandSource(control);
         if (!(source is object[]))
         {
             object obj3;
             if ((currentExpand & ExpandMode.Suggest) > ExpandMode.None)
             {
                 if (this.ExpandForm == null)
                 {
                     this.ExpandForm = new PopupForm();
                     this.ExpandForm.ListBox.FormattingEnabled = true;
                     this.ExpandForm.ListBox.Sorted = true;
                     this.ExpandForm.Click += new EventHandler(this.PopupForm_Click);
                     this.ExpandForm.KeyDown += new KeyEventHandler(this.PopupForm_KeyDown);
                     this.ExpandForm.VisibleChanged += new EventHandler(this.PopupForm_VisibleChanged);
                     this.ExpandForm.ListBox.MouseMove += new MouseEventHandler(this.ListBox_MouseMove);
                     this.ExpandForm.ListBox.Format += new ListControlConvertEventHandler(this.ListBox_Format);
                 }
                 this.ExpandForm.ListBox.BeginUpdate();
                 this.ExpandForm.ListBox.Items.Clear();
                 foreach (object obj2 in source)
                 {
                     this.ExpandForm.ListBox.Items.Add(obj2);
                 }
                 this.ExpandForm.ListBox.EndUpdate();
                 if (this.ExpandForm.ListBox.Items.Count > 0)
                 {
                     this.CurrentText = control.Text;
                     this.ExpandForm.Bounds = GetPopupBounds(control, (Math.Min(15, this.ExpandForm.ListBox.Items.Count) * this.ExpandForm.ListBox.ItemHeight) + 2);
                     this.ExpandForm.Tag = control;
                     this.ExpandForm.Show();
                     flag = false;
                 }
             }
             if (((currentExpand & ExpandMode.Append) > ExpandMode.None) && ((obj3 = source.FirstOrDefault<object>()) != null))
             {
                 ListControlConvertEventArgs args = new ListControlConvertEventArgs(obj3.ToString(), typeof(string), obj3);
                 this.OnFormat(args);
                 int length = control.Text.Length;
                 control.Text = control.Text + args.Value.ToString().Substring(length);
                 SetSelectionRange(control, length, control.Text.Length - length);
             }
         }
         if (flag && (this.ExpandForm != null))
         {
             this.ExpandForm.Hide();
         }
     }
 }
 private void Control_Leave(object sender, EventArgs e)
 {
     this.CurrentExpand = ExpandMode.None;
     if (this.ExpandForm != null)
     {
         this.ExpandForm.Hide();
     }
 }
        private void Control_KeyPress(object sender, KeyPressEventArgs e)
        {
            Control control = (Control) sender;
            switch (GetAutoCompleteMode(control))
            {
                case AutoCompleteMode.Suggest:
                    this.CurrentExpand = ExpandMode.Suggest;
                    break;

                case AutoCompleteMode.Append:
                    this.CurrentExpand = (e.KeyChar >= ' ') ? ExpandMode.Append : ExpandMode.None;
                    break;

                case AutoCompleteMode.SuggestAppend:
                    this.CurrentExpand = ExpandMode.Suggest | ((e.KeyChar >= ' ') ? ExpandMode.Append : ExpandMode.None);
                    break;

                default:
                    this.CurrentExpand = ExpandMode.None;
                    break;
            }
            if ((GetSelectionLength(control) > 0) && (e.KeyChar == '\b'))
            {
                control.BeginInvoke(new EventHandler(this.Control_TextChanged), new object[] { sender, e });
            }
        }
        private void Control_KeyDown(object sender, KeyEventArgs e)
        {
            Control control;
            ListBox listBox;
            this.CurrentExpand = ExpandMode.None;
            if ((this.ExpandForm != null) && this.ExpandForm.Visible)
            {
                control = (Control) sender;
                switch (e.KeyData)
                {
                    case Keys.Up:
                    case Keys.Down:
                        listBox = this.ExpandForm.ListBox;
                        switch (e.KeyData)
                        {
                            case Keys.Up:
                                if (listBox.SelectedIndex >= 0)
                                {
                                    listBox.SelectedIndex--;
                                }
                                else
                                {
                                    listBox.SelectedIndex = listBox.Items.Count - 1;
                                }
                                goto Label_00F9;

                            case Keys.Right:
                                goto Label_00F9;

                            case Keys.Down:
                                if (listBox.SelectedIndex < (listBox.Items.Count - 1))
                                {
                                    listBox.SelectedIndex++;
                                }
                                else
                                {
                                    listBox.SelectedIndex = -1;
                                }
                                goto Label_00F9;
                        }
                        goto Label_00F9;

                    case Keys.Right:
                        return;

                    case Keys.Delete:
                        if (GetSelectionLength(control) > 0)
                        {
                            switch (GetAutoCompleteMode(control))
                            {
                                case AutoCompleteMode.Suggest:
                                case AutoCompleteMode.SuggestAppend:
                                    this.CurrentExpand = ExpandMode.Suggest;
                                    control.BeginInvoke(new EventHandler(this.Control_TextChanged), new object[] { sender, e });
                                    return;

                                case AutoCompleteMode.Append:
                                    return;
                            }
                        }
                        return;
                }
            }
            return;
        Label_00F9:
            if (listBox.SelectedIndex >= 0)
            {
                object listItem = listBox.Items[listBox.SelectedIndex];
                ListControlConvertEventArgs args = new ListControlConvertEventArgs(listItem.ToString(), typeof(string), listItem);
                this.OnFormat(args);
                control.Text = args.Value.ToString();
            }
            else
            {
                control.Text = this.CurrentText;
            }
            SetSelectionRange(control, control.Text.Length, 0);
            e.Handled = true;
            e.SuppressKeyPress = true;
        }
Example #13
0
 public IHtmlAccordionHelper ExpandMode(ExpandMode expandMode)
 {
     _configurationContainer.ExpandMode = expandMode;
     return(this);
 }
Example #14
0
        /// <summary>
        /// Get a key pair from mnemonic
        /// </summary>
        /// <param name="mnemonic"></param>
        /// <param name="password"></param>
        /// <param name="bIP39Wordlist"></param>
        /// <param name="expandMode"></param>
        /// <returns></returns>
        public static KeyPair GetKeyPairFromMnemonic(string mnemonic, string password, BIP39Wordlist bIP39Wordlist, ExpandMode expandMode)
        {
            var secretBytes = GetSecretKeyFromMnemonic(mnemonic, password, bIP39Wordlist);
            var miniSecret  = new MiniSecret(secretBytes, expandMode);

            return(new KeyPair(miniSecret.ExpandToPublic(), miniSecret.ExpandToSecret()));
        }
Example #15
0
 public virtual IPropertyOptionsBuilder <TDeclaring, TProperty> Expand(ExpandMode expandMode)
 {
     return(this);
 }
Example #16
0
 public Expand(ExpandMode mode, Select? @select)
 {
     this.Mode = mode;
     this.Select = @select;
 }
Example #17
0
 public virtual LayoutItemBuilder ExpandMode(ExpandMode expandMode)
 {
     base.Component.ExpandMode = expandMode;
     return(this);
 }