コード例 #1
0
        private void EncPasswordRemoveButton_Click(object sender, RoutedEventArgs e)
        {
            var question = _encQuestionEventDic[sender];
            UIElementCollection passwords = question._passwordStackPanel.Children;

            bool existsPassword = false;

            // second to last text box.
            for (int i = passwords.Count - 3; i >= 2; --i)
            {
                TextBox passwordTextBox = (TextBox)passwords[i];
                if (Util.isEmpty(passwordTextBox.Text, EncTrimChk.IsChecked))
                {
                    passwords.RemoveAt(i);
                }
                else
                {
                    existsPassword = true;
                }
            }

            // first text box.
            if (existsPassword && Util.isEmpty(((TextBox)passwords[1]).Text, EncTrimChk.IsChecked))
            {
                passwords.RemoveAt(1);
            }

            // The first element is label
        }
コード例 #2
0
ファイル: Panel.cs プロジェクト: ndhelix/OpenSilver
 private void RemoveChildren(GeneratorPosition pos, int containerCount)
 {
     // If anything is wrong, I think these collections should do parameter checking
     for (int i = pos.Index; i < pos.Index + containerCount; i++)
     {
         _uiElementCollection.RemoveAt(i);
     }
 }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        protected void removeAllCanvasChildren()
        {
            UIElementCollection children = (AuditoryGameApp.Current.RootVisual as GamePage).LayoutTitle.Children;

            while (children.Count != 0)
            {
                children.RemoveAt(0);
            }

            children = (AuditoryGameApp.Current.RootVisual as GamePage).LayoutRoot.Children;
            while (children.Count != 0)
            {
                children.RemoveAt(0);
            }
        }
        private void panelElemsCount_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e,
                                                  UIElementCollection c, FrameworkElement[] objArray)
        {
            DecimalUpDown d = (DecimalUpDown)sender;

            int Count = (int)d.Value;

            if (c.Count > Count)
            {
                int delNum = c.Count - Count;
                for (int i = 0; i < delNum; i++)
                {
                    c.RemoveAt(c.Count - 1);
                }
            }
            else if (c.Count < Count)
            {
                for (int i = c.Count; i < Count; i++)
                {
                    //c.Add(objArray[i % objArray.Length]);

                    string       gridXaml     = XamlWriter.Save(objArray[i % objArray.Length]);
                    StringReader stringReader = new StringReader(gridXaml);
                    XmlReader    xmlReader    = XmlReader.Create(stringReader);
                    c.Add((FrameworkElement)XamlReader.Load(xmlReader));
                }
            }
        }
コード例 #5
0
 public void Main()
 {
     while (container.Count > 1)
     {
         container.RemoveAt(1);
     }
 }
コード例 #6
0
        public static void Switch(this UIElementCollection col, int from, int to)
        {
            var smallestIndex = from;
            var biggestIndex  = to;

            if (from > to)
            {
                smallestIndex = to;
                biggestIndex  = from;
            }
            var ObjA = col[smallestIndex];
            var ObjB = col[biggestIndex];

            col.RemoveAt(biggestIndex);
            col.RemoveAt(smallestIndex);
            col.Insert(smallestIndex, ObjB);
            col.Insert(biggestIndex, ObjA);
        }
コード例 #7
0
        public void RemoveAt(int index)
        {
            if (index >= 0 && index < _items.Count)
            {
                this[index].SetListBox(null);
            }

            _items.RemoveAt(index);
        }
コード例 #8
0
        /// <summary>
        /// Collects all the border lines from the seek index.
        /// </summary>
        public void Collect()
        {
            int num = _elements.Count;

            for (int i = _seek + 1; i < num; i++)
            {
                _elements.RemoveAt(_seek + 1);
            }
        }
コード例 #9
0
 public static void ClearGrid(this UIElementCollection collection)
 {
     for (int index = collection.Count - 1; index >= 0; index--)
     {
         if ((collection[index] as Shape).Tag as string == "grid")
         {
             collection.RemoveAt(index);
         }
     }
 }
コード例 #10
0
ファイル: MainPage.xaml.cs プロジェクト: leduyquang753/CalcIt
        public void onVariableRemovalRequested(int index)
        {
            UIElementCollection views = variableViewStack.Children;

            views.RemoveAt(index);
            for (int i = index; i < views.Count; i++)
            {
                ((VariableView)views[i]).index = i;
            }
        }
コード例 #11
0
 public static void ClearShapes(this UIElementCollection collection)
 {
     for (int index = collection.Count - 1; index >= 0; index--)
     {
         if ((collection[index] as Shape).Tag == null)
         {
             collection.RemoveAt(index);
         }
     }
 }
コード例 #12
0
        // Метод очистки канваса
        public void ClearAll()
        {
            UIElementCollection collection = DrawArea.Children;

            for (int i = collection.Count - 1; i != 0; i--)
            {
                if (!(collection[i] is StackPanel || collection[i] is ProgressBar))
                {
                    collection.RemoveAt(i);
                }
            }
            GrafPoints = new List <GrafPoint>();
        }
コード例 #13
0
        public bool remove(UIElementCollection collection)
        {
            try
            {
                if (collection.Count > 0)
                {
                    collection.RemoveAt(collection.Count - 1);
                    return(true);
                }

                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #14
0
        public void ArgumentChecks()
        {
            Canvas canvas         = new Canvas();
            UIElementCollection c = canvas.Children;

            Assert.Throws <ArgumentNullException> (() => c.Add(null), "Add");
            Assert.Throws <ArgumentNullException> (() => c.Insert(0, null), "Insert null");
            Assert.Throws <ArgumentOutOfRangeException> (() => c.Insert(-1, new Rectangle()), "Insert negative");
            Assert.Throws <ArgumentOutOfRangeException> (() => c.RemoveAt(-1), "RemoveAt negative");
            Assert.Throws <ArgumentOutOfRangeException> (() => Console.WriteLine(c [-1] == null), "this getter");
            Assert.Throws <ArgumentOutOfRangeException> (() => c [-1] = new Rectangle(), "this setter");

            Assert.IsFalse(c.Contains(null), "Contains");
            Assert.IsFalse(c.Remove(null), "Remove");

            Assert.AreEqual(-1, c.IndexOf(null), "IndexOf");
        }
コード例 #15
0
    /// <summary>
    /// Removes all instances of a type of object from the children collection.
    /// </summary>
    /// <typeparam name="T">The type of object you want to remove.</typeparam>
    /// <param name="targetCollection">A reference to the canvas you want items removed from.</param>
    public static void Remove <T>(this UIElementCollection targetCollection)
    {
        // This will loop to the end of the children collection.
        int index = 0;

        // Loop over every element in the children collection.
        while (index < targetCollection.Count)
        {
            // Remove the item if it's of type T
            if (targetCollection[index] is T)
            {
                targetCollection.RemoveAt(index);
            }
            else
            {
                index++;
            }
        }
    }
コード例 #16
0
        private void NumberStoryboardCompletedEventHandler(object sender, EventArgs e)
        {
            foreach (var tbk in scrollTextBlockList.Cast <TextBlock>())
            {
                tbk.Text   = ((int)tbk.Tag).ToString();
                tbk.Margin = new Thickness(0);
            }

            int count = scrollTextBlockList.Count;

            if (lastNum.Length < count)
            {
                for (int i = 0; i < count - lastNum.Length; i++)
                {
                    scrollTextBlockList.RemoveAt(0);
                }
            }

            stkScroll.Margin = new Thickness(0);

            storyboarding = false;
        }
コード例 #17
0
        void MoveChildren(UIElementCollection origin, int row, string saveKey)
        {
            while (origin.Count > 0)
            {
                var child = origin[0];
                origin.RemoveAt(0);
                Grid.SetRow(child, row);

                Button b = child as Button;

                if (b != null && b.Content is String)
                {
                    if (b.Content.ToString() == "Clear")
                    {
                        Style redButton = MainWindow.mainWindow.FindResource("RedButton") as Style;
                        b.VerticalAlignment   = VerticalAlignment.Center;
                        b.HorizontalAlignment = HorizontalAlignment.Left;
                        b.Margin          = new Thickness(5, 0, 15, 0);
                        b.Content         = "x";
                        b.Height          = 15;
                        b.Width           = 15;
                        b.LayoutTransform = new ScaleTransform(.75, .75);
                        b.Style           = redButton;
                        b.Tag             = saveKey;
                    }

                    if (b.Content.ToString() == "Roll")
                    {
                        b.Click += new RoutedEventHandler(
                            (x, y) =>
                        {
                            Style redButton = MainWindow.mainWindow.FindResource("RedButton") as Style;
                            b.Style         = redButton;
                        });
                    }
                }

                var t = child as TextBlock;

                if (t != null && saveKey != "" && Grid.GetColumn(t) == 2)
                {
                    var helpKey = saveKey.Replace("\\", "/").Substring(1);
                    var iSlash  = helpKey.IndexOf('/');
                    if (iSlash > 0)
                    {
                        var name = helpKey.Substring(0, iSlash);
                        VirtualSheet.MakeHelpRightKey(t, helpKey, name);
                    }
                }

                mainGrid.Children.Add(child);

                var cb = child as ComboBox;

                if (cb == null)
                {
                    continue;
                }

                SetComboDefaultLoc(cb);
            }

            if (saveKey != null && saveKey != "")
            {
                var b = new Button();

                Grid.SetRow(b, row);
                Grid.SetColumn(b, 10);
                b.VerticalAlignment   = VerticalAlignment.Center;
                b.HorizontalAlignment = HorizontalAlignment.Left;
                b.Margin  = new Thickness(5, 0, 5, 0);
                b.Content = "Check";
                b.Click  += new RoutedEventHandler(
                    (object o, RoutedEventArgs args) => {
                    var chk = saveKey.Substring(1).Replace("\\", "/");
                    string name, key;
                    MainWindow.Parse2Ex(chk, out name, out key, '/');
                    string cmd = "!check " + name + " /" + key + "/";
                    MainWindow.mainWindow.SendChat(cmd);
                    MainWindow.mainWindow.SendHost(cmd);
                });
                mainGrid.Children.Add(b);
            }
        }
コード例 #18
0
ファイル: InlineCollection.wasm.cs プロジェクト: jokm1/uno-2
 /// <inheritdoc />
 public void RemoveAt(int index) => _collection.RemoveAt(index);
コード例 #19
0
        public void Refresh()
        {
            if (!this.isUiDirty)
            {
                return;
            }

            this.isUiDirty = false;

            if (this.Map == null)
            {
                this.members.Clear();
                this.tile_host.Children.Clear();
                this.backdrop.Visibility = Visibility.Collapsed;
            }
            else
            {
                int width  = this.Map.Width;
                int height = this.Map.Height;

                this.backdrop.Visibility = Visibility.Visible;
                this.backdrop.Width      = width * 32;
                this.backdrop.Height     = height * 32;
                this.backdrop.Margin     = new Thickness(this.xOffset, this.yOffset, 0, 0);

                int  membersIndex = 0;
                Tile tile;
                UIElementCollection tileHostChildren = this.tile_host.Children;
                Image image;
                Tile[,] tiles = this.Map.Tiles;
                for (int y = 0; y < height; ++y)
                {
                    for (int x = 0; x < width; ++x)
                    {
                        tile = tiles[x, y];
                        if (tile != null)
                        {
                            if (membersIndex == this.members.Count)
                            {
                                image = new Image()
                                {
                                    HorizontalAlignment = HorizontalAlignment.Left,
                                    VerticalAlignment   = VerticalAlignment.Top
                                };

                                RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.NearestNeighbor);
                                this.members.Add(image);
                                tileHostChildren.Add(image);
                            }

                            image        = this.members[membersIndex++];
                            image.Width  = 32;
                            image.Height = 32;
                            image.Margin = new Thickness(this.xOffset + x * 32, this.yOffset + y * 32, 0, 0);
                            image.Source = tile.Thumbnail;
                        }
                    }
                }

                int oldLength = this.members.Count;
                for (int i = membersIndex; i < oldLength; ++i)
                {
                    this.members.RemoveAt(this.members.Count - 1);
                    tileHostChildren.RemoveAt(tileHostChildren.Count - 1);
                }
            }
        }
コード例 #20
0
 public static void RemoveAt(this UIElementCollection collection, Index index)
 => collection.RemoveAt(index.GetOffset(collection.Count));
コード例 #21
0
ファイル: NListPatch.cs プロジェクト: xstos/nreact
 protected override void DoRemove(NListPatchEntry i)
 {
     _target.RemoveAt(i.iRemove);
 }