Exemple #1
0
 // Xoa hinh
 public void removeShape(UIElementCollection collection)
 {
     if (lastCC != null)
     {
         collection.Remove((Shape)lastCC.Content);
         collection.Remove(lastCC);
         lastCC = null;
     }
 }
Exemple #2
0
        /// <summary>
        /// Quita los componentes a la vetnana en caso de que
        /// no se marque la casilla de seguro
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void c_seguro_Unchecked(object sender, RoutedEventArgs e)
        {
            UIElementCollection componentes = sp_componentes.Children;

            componentes.Remove(lb_numPolizaSeguro);
            componentes.Remove(tb_numPolizaSeguro);
            componentes.Remove(lb_nombreAseguradora);
            componentes.Remove(tb_nombreAseguradora);
        }
Exemple #3
0
        /// <summary>
        /// Removes the HITView from the sidebar
        /// </summary>
        public void RemoveHITVIew()
        {
            Word.Document doc = Globals.Soylent.Application.ActiveDocument;

            UIElementCollection children = Globals.Soylent.soylentMap[doc].sidebar.jobs.Children;

            // We might be in stub mode or in full mode
            children.Remove((UIElement)this.Parent);
            children.Remove(((UIElement)stub.Parent));
            //Globals.Soylent.soylentMap[doc].sidebar.jobs.Children.Clear();
        }
        /// <summary>
        /// Remove elements from the UIElementCollection which have a matching
        /// Tag string.
        /// </summary>
        /// <param name="ElemColl"></param>
        /// <param name="TagName"></param>
        public static void RemoveByTag(
            this UIElementCollection ElemColl, string TagName)
        {
            // build list of elements to remove.
            List <FrameworkElement> removeElements = new List <FrameworkElement>();

            foreach (UIElement elem in ElemColl)
            {
                if (elem is FrameworkElement)
                {
                    FrameworkElement fwe = elem as FrameworkElement;
                    if ((fwe.Tag != null) && (fwe.Tag is string))
                    {
                        string tabText = fwe.Tag as string;
                        if (tabText == TagName)
                        {
                            removeElements.Add(fwe);
                        }
                    }
                }
            }

            // remove the elements.
            foreach (FrameworkElement elem in removeElements)
            {
                ElemColl.Remove(elem);
            }
        }
Exemple #5
0
        private void RemoveSpecificEnemyFromGrid(string tag)
        {
            UIElementCollection collection = grid_Action.Children;
            List <Image>        images     = new List <Image>();

            foreach (var elem in collection)
            {
                if (elem is Image)
                {
                    Image image = (Image)elem;
                    images.Add(image);
                }
            }

            foreach (var img in images)
            {
                string name = img.Name;
                if (name == "Enemy")
                {
                    if (img.Tag.ToString() == tag)
                    {
                        collection.Remove(img);
                    }
                }
            }
        }
Exemple #6
0
 public static void Remove(this UIElementCollection collection, Line l)
 {
     foreach (var el in l.UIElements)
     {
         collection.Remove(el);
     }
 }
Exemple #7
0
 public ModuleBox(Module module, Color col, UIElementCollection container = null, Course model = null)
 {
     this.InitializeComponent();
     SetEditableItems(moduleNameEdit);
     SetStaticItems(moduleName);
     self = module;
     deleteButton.Click += async(e, ev) =>
     {
         //OnDelete(this);
         MessageDialog diag = new MessageDialog("This action cannot be undone", "Are you sure you want to delete " + model.Name);
         diag.Commands.Add(new UICommand("Delete", (d) =>
         {
             container.Remove(this);
             model.Modules.Remove(self);
         }));
         diag.Commands.Add(new UICommand("Cancel"));
         await diag.ShowAsync();
     };
     moduleNameEdit.TextChanged += (e, ev) =>
     {
         Validator.isStringValid(
             target: moduleNameEdit.Text, scope: "name", allowDigits: false, allowEmpty: false, max: Validator.EventTeacherMax,
             autoFix: true, fixTarget: moduleNameEdit, autoNotify: true);
         moduleName.Text = moduleNameEdit.Text;
         self.Name       = moduleNameEdit.Text;
         // OnChange();
     };
     this.Loaded += (e, ev) =>
     {
         moduleName.Text     = module.Name;
         moduleNameEdit.Text = module.Name;
         root.Background     = new SolidColorBrush(col);
     };
 }
Exemple #8
0
 public static void Remove(this UIElementCollection collection, Circle c)
 {
     foreach (var el in c.UIElements)
     {
         collection.Remove(el);
     }
 }
Exemple #9
0
        /// <summary>
        /// Shows the progress overlay
        /// </summary>
        /// <param name="message">Message to display in the progress</param>
        public void Show(string message)
        {
            if (!isShowing)
            {
                if (progressOverlay == null)
                {
                    progressOverlay =
                        XamlReader.Load(progressOverlayTemplate) as Coding4Fun.Toolkit.Controls.ProgressOverlay;
                }

                Grid newParent = Mowbly.ActivePhoneApplicationPage.GetContentPanel();
                // Remove the progress overlay from the current parent if available
                // and if the new parent and the old parent is not same
                if (parent != null && !newParent.Equals(parent))
                {
                    UIElementCollection children = parent.Children;
                    if (children.Contains(progressOverlay))
                    {
                        children.Remove(progressOverlay);
                    }
                }

                // Add it the the new parent
                parent = newParent;
                parent.Children.Add(progressOverlay);
                progressOverlay.Show();
                isShowing = true;
                // Set progressbar indeterminate to true
                ((ProgressBar)((StackPanel)progressOverlay.Content).Children[1]).IsIndeterminate = true;
            }

            // Set the message
            ((TextBlock)((StackPanel)progressOverlay.Content).Children[0]).Text = message;
        }
Exemple #10
0
 public static void RemoveAll(this UIElementCollection collection, IEnumerable <UIElement> visuals)
 {
     foreach (UIElement visual in visuals)
     {
         collection.Remove(visual);
     }
 }
        public void LoadSettings()
        {
            //Remove Comment Lines obtained while collecting values from server.properties
            for (int i = 0; i < ServerPropertiesValues.Length - 2; i++)
            {
                ServerPropertiesValues[i] = ServerPropertiesValues[i + 2];
            }

            //Showing Values
            UIElementCollection uIElementCollection = new UIElementCollection(this, grid);

            foreach (Label label in uIElementCollection)
            {
                uIElementCollection.Remove(label);
            }

            SpawnProtectionValue.Text    = GetStrVal("spawn-protection");
            MaxTickTimeValue.Text        = GetStrVal("max-tick-time");
            QueryPortValue.Text          = GetStrVal("query.port");
            GeneratingSettingsValue.Text = GetStrVal("generator-settings");
            ForceGamemodeValue.IsChecked = GetBoolVal("force-gamemode", ForceGamemodeValue);

            /*
             * if (GetBoolVal("force-gamemode", ForceGamemodeValue))
             * {
             *  ForceGamemodeValue.BeginStoryboard((Storyboard)ForceGamemodeValue.FindResource("CheckBoxChecking"));
             *  ForceGamemodeValue.IsChecked = true;
             * }
             */
        }
        private async void ReloadPage(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine("Initiating Page reload");
            ReloadingIndicator.Visibility = Visibility.Visible;

            List <Service> services = null;

            try
            {
                services = await Connection.RefreshServiceCache();
            }
            catch (Exception ex)
            {
                UIElementCollection children = ((Panel)_rootBox.Parent).Children;
                foreach (UIElement uiElement in children.Where(it => it != _rootBox).ToArray())
                {
                    children.Remove(uiElement);
                }
                _rootBox.ServiceName = "Status Server is Unreachable";
                _rootBox.StatusText  = $"Could not fetch services - [{ex.GetType().Name}]: {ex.Message}";
                _rootBox.StatusColor = ServiceBox.ConvertColor(ServiceStatus.OfflineColor);
                services             = new List <Service>();
            }

            foreach (Service service in services)
            {
                ServiceBox existing = ComputeServiceBox(service);
                existing.UpdateDisplay(service);
            }

            ReloadingIndicator.Visibility = Visibility.Collapsed;
            Debug.WriteLine(
                $"Reload complete with {services.Count} services; Stacker has {ServiceList.Children.Count} children");
        }
Exemple #13
0
        private void RemoveSpecificItem(int x, int y)
        {
            UIElementCollection collection = grid_Map.Children;

            List <Image> images = new List <Image>();

            foreach (var item in collection)
            {
                if (item is Image)
                {
                    Image  image = (Image)item;
                    string tag   = $"{x}-{y}";

                    if (image.Tag.ToString() == tag)
                    {
                        images.Add(image);
                    }
                }
            }

            foreach (var item in images)
            {
                collection.Remove(item);
            }
        }
Exemple #14
0
        internal static void MakeVideoCall(string primaryId, UIElementCollection uiElementCollection, int timeoutInSeconds, string secondaryId = null)
        {
            CommunicationView commView = new CommunicationView(primaryId, timeoutInSeconds);

            uiElementCollection.Add(commView);
            commView.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            commView.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
            commView.Width               = 700;
            commView.Height              = 400;
            commView.CommunicationEnded += (p1, p2) =>
            {
                if (commView.TimedOut &&
                    string.IsNullOrEmpty(secondaryId) == false)
                {
                    commView.InitializeUI(secondaryId);
                    secondaryId = null;
                    return;
                }
                else
                {
                    commView.Visibility = Visibility.Collapsed;
                    uiElementCollection.Remove(commView);
                }
            };
        }
Exemple #15
0
 public static void RemoveAll <T>(this UIElementCollection c, Func <T, bool> pred)
     where T : UIElement
 {
     foreach (var match in c.OfType <T>().Where(pred).ToArray())
     {
         c.Remove(match);
     }
 }
Exemple #16
0
        /// <summary>
        /// Remove the current candidate grid points
        /// </summary>
        public void RemoveCurrentCandidateGridPoints(UIElementCollection elemColl)
        {
            for (int index = 0; index < mCandidateGridPointMarkings.Count; index++)
            {
                elemColl.Remove(mCandidateGridPointMarkings[index]);
            }

            mCandidateGridPointMarkings.Clear();
        }
Exemple #17
0
        public static void RemoveAll(this UIElementCollection collection, UIElement[] elements)
        {
            var n = elements?.Length ?? 0;

            for (var i = 0; i < n; i++)
            {
                collection.Remove(elements[i]);
            }
        }
        public static void RemoveElementOfType <T>(this UIElementCollection source) where T : UIElement
        {
            T ctrl = FindElementOfType <T>(source);

            if (ctrl != null)
            {
                source.Remove(ctrl);
            }
        }
        public static void Remove(this UIElementCollection collection, IEnumerable <UIElement> toRemove)
        {
            var t = new List <UIElement>(toRemove);

            foreach (var uiElement in t)
            {
                collection.Remove(uiElement);
            }
        }
Exemple #20
0
        internal void RemoveFromUICollection(UIElementCollection collection)
        {
            foreach (var uiElement in UIElements)
            {
                collection.Remove(uiElement);
            }

            UIElements.Clear();
        }
Exemple #21
0
        public void RecyclePDFTextItemsFromChildren(UIElementCollection children)
        {
            List <PDFTextItem> children_to_kill = new List <PDFTextItem>(children.OfType <PDFTextItem>());

            foreach (PDFTextItem pdf_text_item in children_to_kill)
            {
                children.Remove(pdf_text_item);
                RecyclePDFTextItem(pdf_text_item);
            }
        }
Exemple #22
0
        private void Timer_Tick(object sender, object e)
        {
            UIElementCollection canvasChildrens = _canvas.Children;

            foreach (Image image in _explosions)
            {
                canvasChildrens.Remove(image);
            }
            _timer.Stop();
        }
        public StructureBlockControl(StructureBlock block, Windows.UI.Color c, UIElementCollection container = null, Module module = null)
        {
            this.InitializeComponent();
            root.Background = new SolidColorBrush(c);
            SetEditableItems(nameEdit);
            SetStaticItems(name);
            self          = block;
            name.Text     = self.Name;
            nameEdit.Text = self.Name;
            foreach (Topic topic in block.Topics)
            {
                TopicControl cont = new TopicControl(topic);
                topicsHolder.Children.Add(cont);
                cont.OnChange += () => OnChange();
                cont.OnDelete += (tpC) =>
                {
                    self.Topics.Remove(tpC.self);
                    topicsHolder.Children.Remove(tpC);
                    // OnChange();
                };
            }
            addButton.Tapped += (e, ev) =>
            {
                Topic        topic = new Topic();
                TopicControl cont  = new TopicControl(topic);
                if (isEditable)
                {
                    cont.setEditable(true);
                }
                topicsHolder.Children.Add(cont);
                self.Topics.Add(topic);

                //cont.OnChange += () => ;
                cont.OnDelete += (tpC) =>
                {
                    self.Topics.Remove(tpC.self);
                    topicsHolder.Children.Remove(tpC);
                    //OnChange();
                };
            };
            deleteButton.Tapped += (e, ev) =>
            {
                //OnDelete(this);
                container.Remove(this);
                module.StructureBlocks.Remove(self);
            };
            nameEdit.TextChanged += (e, ev) =>
            {
                Validator.isStringValid(
                    target: nameEdit.Text, scope: "name", allowDigits: false, allowEmpty: true, max: Validator.StructureBlockNameMax,
                    autoFix: true, fixTarget: nameEdit, autoNotify: true);
                name.Text = nameEdit.Text;
                self.Name = nameEdit.Text;
            };
        }
Exemple #24
0
        public static void CopyObjects(DependencyObject source, DependencyObject destination)
        {
            if (source is IAddChild)
            {
                ContentPropertyAttribute srcCntAttr;
                if ((TypeDescriptor.GetAttributes(source)[typeof(ContentPropertyAttribute)] is ContentPropertyAttribute))
                {
                    srcCntAttr = TypeDescriptor.GetAttributes(source)[typeof(ContentPropertyAttribute)] as ContentPropertyAttribute;
                    if (destination.GetType().GetProperty(srcCntAttr.Name) != null)
                    {
                        System.Reflection.PropertyInfo pi = source.GetType().GetProperty(srcCntAttr.Name);
                        object srcChild  = pi.GetValue(source, null);
                        object destChild = pi.GetValue(destination, null);
                        if (srcChild is UIElementCollection && destChild is UIElementCollection)
                        {
                            UIElementCollection srcColl  = srcChild as UIElementCollection;
                            UIElementCollection destColl = destChild as UIElementCollection;
                            destColl.Clear();
                            while (srcColl.Count > 0)
                            {
                                UIElement el = srcColl[0];
                                srcColl.Remove(el);
                                destColl.Add(el);
                            }
                        }
                        else if (srcChild is DependencyObject && destChild is DependencyObject)
                        {
                            CopyObjects(srcChild as DependencyObject, destChild as DependencyObject);
                        }
                    }
                }
            }
            IList <DependencyProperty> spl = GetSetedProperties(source);
            IList <DependencyProperty> dpl = GetSetedProperties(destination);

            foreach (DependencyProperty property in dpl)
            {
                try
                {
                    if (property.ReadOnly != true && property.Name != "Style")
                    {
                        destination.SetValue(property, source.ReadLocalValue(property));
                    }
                }
                catch (Exception)
                {
                }
            }

            /*foreach (DependencyProperty property in spl)
             * {
             *  destination.SetValue(property, source.ReadLocalValue(property));
             *
             * }*/
        }
Exemple #25
0
 private void btnBack_Click(object sender, RoutedEventArgs e)
 {
     if (this.Parent != null)
     {
         UIElementCollection children = ((Panel)this.Parent).Children;
         if (children.Contains(this))
         {
             children.Remove(this);
         }
     }
 }
Exemple #26
0
        /// <summary>
        /// remove the last movement vector and return the number of UIElements actually removed
        /// </summary>
        /// <param name="children"></param>
        /// <returns></returns>
        internal static uint RemoveLastMovementVector(UIElementCollection children, IList <UIElement> movementVectorElements)
        {
            for (uint index = 0; index < nrOfUIElements; index++)
            {
                // remove arrow line angle2, arrow line angle1 and the main line
                int movVecElIndex = (int)(movementVectorElements.Count - 1 - index);
                children.Remove(movementVectorElements[movVecElIndex]);
            }

            return(nrOfUIElements);
        }
Exemple #27
0
        private void Btn_Inventory_Filter_Clicked(object sender, RoutedEventArgs e)
        {
            Button        filter = (Button)e.Source;
            string        name   = filter.Name;
            List <String> names  = _gameViewModel.FilterInventoryByList(name);

            List <TextBlock>   textBlocks   = new List <TextBlock>();
            List <RadioButton> radioButtons = new List <RadioButton>();

            UIElementCollection collection = inv_Obj.Children;


            foreach (var x in collection)
            {
                foreach (var y in names)
                {
                    if (x is TextBlock)
                    {
                        TextBlock xBlock = (TextBlock)x;
                        if (xBlock.Tag.ToString() != y)
                        {
                            textBlocks.Add(xBlock);
                        }
                    }
                    if (x is RadioButton)
                    {
                        RadioButton xBtn = (RadioButton)x;
                        if (xBtn.Tag.ToString() != y)
                        {
                            radioButtons.Add(xBtn);
                        }
                    }
                }
            }

            for (int i = 0; i < textBlocks.Count; i++)
            {
                collection.Remove(textBlocks[i]);
                collection.Remove(radioButtons[i]);
            }
        }
Exemple #28
0
        private CardView GetCardFromBoard(UIElementCollection column, Card card)
        {
            foreach (CardView view in column)
            {
                if (view.DataContext == card)
                {
                    column.Remove(view);
                    return(view);
                }
            }

            return(null);
        }
Exemple #29
0
    private void Shuffle(UIElementCollection list)
    {
        Random rand = new Random();
        int    n    = list.Count;

        while (n > 1)
        {
            n--;
            int    k     = rand.Next(n + 1);
            Button value = list.OfType <Button>().ElementAt(n);
            list.Remove(value);
            list.Insert(k, value);
        }
    }
Exemple #30
0
        public void AddRemove()
        {
            UIElementCollection uiec = GetUIElementCollection();

            Assert.AreEqual(0, uiec.Count, "Count-0");

            Slider s = new Slider();

            uiec.Add(s);
            Assert.AreEqual(1, uiec.Count, "Count-1");

            uiec.Remove(s);
            Assert.AreEqual(0, uiec.Count, "Count-2");
        }
Exemple #31
0
 public static void DeleteFromCollection(UIElementCollection extensions, Guid extGuid)
 {
     foreach (dynamic child in extensions)
     {
         if (child is IExtension)
         {
             if (((Guid)child.ExtensionManifest.UniqueID).ToString() == extGuid.ToString())
             {
                 X.Services.Extensions.ExtensionsService.Instance.UninstallInstance((Guid)child.ExtensionManifest.UniqueID);
                 extensions.Remove(child);
                 break;
             }
         }
     }
 }