Ejemplo n.º 1
0
        /// <summary>
        /// Clears (removes) all assignments from the specified group.
        /// </summary>
        public void Clear()
        {
            foreach (var point in Points)
            {
                Remove(point);
            }

            foreach (var frame in Frames)
            {
                Remove(frame);
            }

            foreach (var area in Areas)
            {
                Remove(area);
            }

            foreach (var link in Links)
            {
                Remove(link);
            }

            Points.Clear();
            Frames.Clear();
            Areas.Clear();
            Links.Clear();
            Cables.Clear();
            Tendons.Clear();
            Solids.Clear();
        }
Ejemplo n.º 2
0
        private void UpdateLocationData()
        {
            Name        = CurrentLocation.Label;
            AltNames    = CurrentLocation.AltNames;
            Id          = CurrentLocation.Id;
            Description = CurrentLocation.Description;
            ParentId    = CurrentLocation.ParentId;

            Type          = CurrentLocation.Type;
            IsDepartable  = CurrentLocation.IsDepartable;
            LabelOnHybrid = CurrentLocation.LabelOnHybrid;
            MinZoom       = CurrentLocation.MinZoomLevel;

            AltNames = new List <string>();
            if (CurrentLocation.AltNames.Count > 0)
            {
                AltNames = CurrentLocation.AltNames;
            }

            Links.Clear();
            if (CurrentLocation.Links.Count > 0)
            {
                foreach (KeyValuePair <string, string> entry in CurrentLocation.Links)
                {
                    Links.Add(new Link()
                    {
                        Name = entry.Key, Address = entry.Value,
                    });
                }
            }
        }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            if (_initialized)
            {
                return;
            }
            _initialized = true;

            Links.Clear();
            if (AddAllLink)
            {
                Links.Add(new Link {
                    DisplayName = UiStrings.FiltersLinkAll,
                    Source      = _source
                });
            }

            foreach (var link in from x in ValuesStorage.GetStringList(KeyGroup)
                     where !string.IsNullOrWhiteSpace(x)
                     select new LinkInput(_source, x))
            {
                Links.Add(link);
                link.PropertyChanged += Link_PropertyChanged;
                link.Close           += OnLinkClose;
            }

            var rightLink = new LinkInputEmpty(Source);

            Links.Add(rightLink);
            rightLink.NewLink += OnNewLink;

            RecentlyClosedQueue.AddRange(ValuesStorage.GetStringList(KeyRecentlyClosed));
            LoadSelected();
        }
Ejemplo n.º 4
0
 public void Clear()
 {
     Entities.Clear();
     Links.Clear();
     FileName = "Untitled.ctr";
     Changed  = false;
 }
Ejemplo n.º 5
0
        protected override void InternalExecute(object parameter)
        {
            Application.Current.Dispatcher.Invoke(delegate
            {
                Links.Clear();
            });
            var result = LinkCollection.FromFile(InputFile);

            Processed = 0;
            Total     = result.Count;
            var no        = 0;
            var itemtasks = new List <Task>();
            var c         = CancelToken;

            foreach (var item in result)
            {
                Helper.Sleep();
                c.Token.ThrowIfCancellationRequested();
                var xx = item;
                Application.Current.Dispatcher.Invoke(delegate
                {
                    Links.Add((LinkModel)xx);
                });
                ++no;
                item.No = no;
                var x        = item;
                var itemtask = Task.Factory.StartNew(() => { x.CountAnchors(c); }, c.Token)
                               .ContinueWith(a =>
                                             TaskCompelted()
                                             );
                itemtasks.Add(itemtask);
            }
            Task.WaitAll(itemtasks.ToArray(), c.Token);
        }
Ejemplo n.º 6
0
        public void ClearContent()
        {
            Links.Clear();
            Nodes.Clear();

            int xPos = 0;

            foreach (var stateName in _stateList)
            {
                var node = stateName;
                if (_groupStateNameByStateModelName.ContainsKey(stateName))
                {
                    node = _groupStateNameByStateModelName[stateName];
                }

                if (Nodes.FirstOrDefault(e => e.Key == node) == null)
                {
                    Nodes.Add(new NodeData()
                    {
                        Key        = node,
                        Text       = node,
                        IsSubGraph = true,
                        Location   = new Point(xPos, 0)
                    });
                    xPos += HorizontalSpace;
                }
            }
        }
Ejemplo n.º 7
0
        private void parseText()
        {
            MatchCollection matches = _urlEx.Matches(_originalText);

            Text = _originalText;
            Links.Clear();
            foreach (Match match in matches)
            {
                if (match.Groups.Count < 3)
                {
                    continue;
                }

                string link     = match.Groups[1].Value;
                string linkText = match.Groups[2].Value;

                Text = Text.Replace(match.Value, match.Groups[2].Value);

                int linkIndex = Text.IndexOf(linkText, System.StringComparison.Ordinal);
                if (linkIndex == -1)
                {
                    continue;
                }

                Links.Add(linkIndex, linkText.Length, link);
            }
        }
Ejemplo n.º 8
0
        public async Task Clear()
        {
            await Initialize();

            await _comments.Clear();

            await _links.Clear();
        }
Ejemplo n.º 9
0
 public void Clear()
 {
     Hide = Visibility.Hidden;
     Links.Clear();
     Sorted      = false;
     HaveClaster = false;
     RePrint();
 }
Ejemplo n.º 10
0
 private async void loadCategorie()
 {
     Links.Clear();
     Links.Add(new Link {
         DisplayName = "Chargement ..."
     });
     await Task.Factory.StartNew(() => Service.LoadCategories());
 }
Ejemplo n.º 11
0
        private void OnUpdateLinkViewModelsListMessage(UpdateLinkViewModelsListMessage msg)
        {
            Links.Clear();

            foreach (var item in msg.LinkViewModels)
            {
                Links.Add(item);
            }
        }
Ejemplo n.º 12
0
 // update the treeViewModel
 public void UpdateTree(Tree tree, bool isRootMax)
 {
     xCounter = 10;
     yCounter = 10;
     Items.Clear();
     Links.Clear();
     if (tree != null && tree.Root != null)
     {
         AddNode(tree.Root, isRootMax);
     }
 }
Ejemplo n.º 13
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     try
     {
         base.OnMouseMove(e);
     }
     catch (OverflowException)
     {
         // See comments in OnPaint
         Links.Clear();
     }
 }
Ejemplo n.º 14
0
 public void Dispose()
 {
     // !!! we need to handle disposing the ImageList better, it references textures.
     Images.Clear();
     Images = null;
     Links.Clear();
     Links = null;
     if (Texture != null)
     {
         Texture.Dispose();
     }
 }
Ejemplo n.º 15
0
        public void ExpandLinks()
        {
            var links = new List <ExtractedVariable>(new[] { this });

            NoteLinks(links, this);
            links.Remove(this);
            if (links.Any())
            {
                m_Values.AddRange(links.SelectMany(x => x.Values));
                IsUsingListValues = links.All(x => x.IsUsingListValues);
                m_Values          = Values.Distinct().ToList();
                Links.Clear();
            }
        }
Ejemplo n.º 16
0
 protected override void OnPaint(PaintEventArgs e)
 {
     try
     {
         base.OnPaint(e);
     }
     catch (OverflowException)
     {
         // The SetMeasureableCharacterRanges API fails with an OverflowException
         // if the is too much text in the LinkLabel. If I could turn UseCompatibleTextRendering
         // off for this one control then this would work, but this is controlled
         // at the application level.
         Links.Clear();
     }
 }
Ejemplo n.º 17
0
        // while download button is clicked
        private void Download_Click(object sender, RoutedEventArgs args)
        {
            int index = Files.SelectedIndex;
            DownloadLinksViewModel item = Links[index];

            // open a SaveFileDialog to choose where to save the file
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName = "video." + item.Type;
            sfd.Filter   = "All Files (*.*) | *.*";
            if ((bool)sfd.ShowDialog())
            {
                //ToggleControls(false);

                // determine the filename set by user.
                string fileName  = sfd.FileName;
                int    taskIndex = DownloadTasks.Count;
                DownloadItems.Add(new DownloadListViewModel()
                {
                    Title    = fileName,
                    Progress = 0,
                    Tag      = taskIndex
                });


                WebClient client = new WebClient();
                client.DownloadProgressChanged += (s, e) =>
                {
                    // update the progress bar
                    DownloadItems[taskIndex].Progress = e.ProgressPercentage;
                };

                client.DownloadFileCompleted += (s, e) => {
                };

                // start to download file.
                Task task = client.DownloadFileTaskAsync(new Uri(Links[index].Link), fileName);
                DownloadTasks.Add(task);

                // clear the url and combobox
                Url.Text = "";
                Url.Focus();
                Links.Clear();
            }
        }
Ejemplo n.º 18
0
        private async void Refresh()
        {
            try
            {
                Refreshing = true;

                LinkListing = await RedditApiClient.Top();

                Links.Clear();
                foreach (var link in LinkListing.Links)
                {
                    Links.Add(new RedditLinkViewModel(link));
                }
            }
            finally
            {
                Refreshing = false;
            }
        }
Ejemplo n.º 19
0
        /////////////////////////////////////////////////////////////////////////////

        #endregion

        //////////////////////////////////////////////////////////////////////

        /// <summary>given a stream, parses it to construct the Feed object out of it</summary>
        /// <param name="stream"> a stream representing hopefully valid XML</param>
        /// <param name="format"> indicates if the stream is Atom or Rss</param>
        //////////////////////////////////////////////////////////////////////
        public void Parse(Stream stream, AlternativeFormat format)
        {
            Tracing.TraceCall("parsing stream -> Start:" + format.ToString());
            BaseFeedParser feedParser = null;

            // make sure we reset our collections
            Authors.Clear();
            Contributors.Clear();
            Links.Clear();
            Categories.Clear();

            feedParser = new AtomFeedParser(this);

            // create a new delegate for the parser
            feedParser.NewAtomEntry        += new FeedParserEventHandler(OnParsedNewEntry);
            feedParser.NewExtensionElement += new ExtensionElementEventHandler(OnNewExtensionElement);
            feedParser.Parse(stream, this);

            Tracing.TraceInfo("Parsing stream -> Done");
            // done parsing
        }
Ejemplo n.º 20
0
        private async Task CheckLinks()
        {
            this.checker?.Links.Clear();
            var links = LinkChecker.FindLinks(this.SourceValue);

            if (!links.Any())
            {
                MessageBox.Show("No links found.");
                return;
            }

            OpenLinkCheckerWindow();
            this.checker !.Links.Clear();

            foreach (var lnk in links)
            {
                checker.Links.Add(new BindableLinkDescription(lnk));
            }

            checker.Focus();

            await checker.CheckAllLinks().ConfigureAwait(false);
        }
Ejemplo n.º 21
0
        protected override void WriteElementExtensions(XmlWriter writer, string version)
        {
            var tmpList = new BindingList <SyndicationItem>();

            Links.Clear();

            foreach (var item in Items)
            {
                var syndicationItem = new SyndicationItem(item.Title.Text, item.Summary.Text, null)
                {
                    LastUpdatedTime = item.LastUpdatedTime,
                    Id = item.Id
                };

                foreach (var autor in item.Authors)
                {
                    syndicationItem.Authors.Add(autor);
                }

                tmpList.Add(syndicationItem);
            }

            Items = tmpList;
        }
Ejemplo n.º 22
0
        // While the fetch button is clicked
        private void Fetch_Click(object sender, RoutedEventArgs args)
        {
            var content = Url.Text;

            // clear the download links
            Links.Clear();

            ToggleControls(false);

            WebClient client = new WebClient();

            client.DownloadStringCompleted += (s, e) =>
            {
                if (e.Error == null)
                {
                    var text = e.Result;

                    // ready to parse the links maps
                    Regex           regex = new Regex("url_encoded_fmt_stream_map\": \"([^\"]*)?\"");
                    MatchCollection mc    = regex.Matches(text);
                    if (mc.Count > 0)
                    {
                        Match  m          = mc[0];
                        string streamMaps = m.Groups[1].Value;

                        string[] urls = streamMaps.Split(new char[] { ',' });
                        foreach (string u in urls)
                        {
                            string[] parameters = u.Split(new string[] { "\\u0026" }, StringSplitOptions.RemoveEmptyEntries);

                            Dictionary <string, string> paramMap = new Dictionary <string, string>();

                            foreach (string p in parameters)
                            {
                                int eqPos = p.IndexOf('=');
                                paramMap.Add(p.Substring(0, eqPos), WebUtility.UrlDecode(p.Substring(eqPos + 1)));
                            }

                            // extract the file type
                            int typePos = paramMap["type"].IndexOf(';');
                            int typeLen = typePos - 6; // 6 is the length of 'video/' +1
                            if (typePos == -1)         // there's no semicolon here.
                            {
                                typeLen = paramMap["type"].Length - 6;
                            }
                            string fileType = paramMap["type"].Substring(6, typeLen);
                            if (fileType == "x-flv")
                            {
                                fileType = "flv";
                            }

                            // Insert a links into the view model
                            Links.Add(new DownloadLinksViewModel()
                            {
                                Title = paramMap["quality"] + " (" + paramMap["type"] + ")",
                                Type  = fileType,
                                Link  = paramMap["url"] + "&signature=" + paramMap["sig"]
                            });
                        }
                    }

                    if (Links.Count > 0)
                    {
                        Files.SelectedIndex = 0;
                    }

                    ToggleControls(true);
                }
                else
                {
                    MessageBox.Show("There's something wrong! Please try again later.");
                }
            };

            // start to fetch and parse the download links
            client.DownloadStringAsync(new Uri(content));
        }
Ejemplo n.º 23
0
 public override void Clear()
 {
     Triads.Clear();
     Links.Clear();
     Sphere.Clear();
 }
Ejemplo n.º 24
0
        /// <summary>
        ///   This needs to be called after anything in the model is changed.
        /// </summary>
        public void SyncFromModel()
        {
            // this pulls down information from the Model element into the atom item.
            Id          = Model.CanonicalName;
            Title       = new TextSyndicationContent(Model.CosmeticName);
            Summary     = new TextSyndicationContent(Model.PackageDetails.SummaryDescription);
            PublishDate = Model.PackageDetails.PublishDate;
            Authors.Clear();
            Contributors.Clear();
            Categories.Clear();
            Links.Clear();

            if (Model.PackageDetails.Publisher != null)
            {
                Authors.Add(CreatePerson().With(a => {
                    a.Name  = Model.PackageDetails.Publisher.Name;
                    a.Email = Model.PackageDetails.Publisher.Email;
                    a.Uri   = Model.PackageDetails.Publisher.Location == null ? string.Empty : Model.PackageDetails.Publisher.Location.ToString();
                }));
            }
            if (!Model.PackageDetails.Contributors.IsNullOrEmpty())
            {
                foreach (var c in Model.PackageDetails.Contributors)
                {
                    var contributor = c;
                    Contributors.Add(CreatePerson().With(a => {
                        a.Name  = contributor.Name;
                        a.Email = contributor.Email;
                        a.Uri   = contributor.Location == null ? string.Empty : contributor.Location.ToString();
                    }));
                }
            }

            if (!string.IsNullOrEmpty(Model.PackageDetails.CopyrightStatement))
            {
                Copyright = new TextSyndicationContent(Model.PackageDetails.CopyrightStatement);
            }

            if (!Model.PackageDetails.Tags.IsNullOrEmpty())
            {
                foreach (var tag in Model.PackageDetails.Tags)
                {
                    Categories.Add(new SyndicationCategory(tag, "/Tags", tag));
                }
            }

            if (!Model.PackageDetails.Categories.IsNullOrEmpty())
            {
                foreach (var category in Model.PackageDetails.Categories)
                {
                    Categories.Add(new SyndicationCategory(category, "/Categories", category));
                }
            }

            if (Model.PackageDetails.Description != null)
            {
                Content = SyndicationContent.CreateHtmlContent(Model.PackageDetails.Description);
            }

            if (!Model.Locations.IsNullOrEmpty())
            {
                foreach (var l in Model.Locations)
                {
                    var location = l;
                    Links.Add(CreateLink().With(link => {
                        link.RelationshipType = "enclosure";
                        link.MediaType        = "application/package";
                        link.Uri   = location;
                        link.Title = Model.Name;
                    }));

                    Links.Add(CreateLink().With(link => {
                        link.Uri = location;
                    }));
                }
            }
            // and serialize that out.
            ElementExtensions.Add(Model, Model.XmlSerializer);
        }
Ejemplo n.º 25
0
 private void DismissAll()
 {
     Links.Clear();
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Updates the links.
        /// </summary>
        /// <returns><c>true</c> if success, <c>false</c> otherwise.</returns>
        private bool updateLinks()
        {
            HtmlWeb hw = new HtmlWeb();

            try
            {
                if (this.isLocal)
                {
                    this.doc = hw.Load(this.local_url);
                }
                else
                {
                    this.doc = hw.Load(this.url);
                }
            }
            catch
            {
                Console.WriteLine("Nepodržani dokument!");
            }



            HtmlNodeCollection col = doc.DocumentNode.SelectNodes("//a[@href]");

            List <HtmlNode> oldLinks = new List <HtmlNode>(this.Links);

            Links.Clear();

            if (col == null)
            {
                return(false);
            }

            foreach (HtmlNode link in col)
            {
                if (link.Attributes["href"].Value.Length == 0)
                {
                    continue;
                }
                CompareInfo ci = CultureInfo.InvariantCulture.CompareInfo;
                bool        x  = ci.IsPrefix(link.Attributes["href"].Value, "http");
                bool        y  = ci.IsPrefix(link.Attributes["href"].Value, "mailto:");
                if (y)
                {
                }
                else if (!x)
                {
                    if (link.Attributes["href"].Value[0] == '#')
                    {
                        link.Attributes["href"].Value = url;
                        continue;
                    }
                    if (ci.IsPrefix(link.Attributes["href"].Value, "javascript"))
                    {
                        continue;
                    }
                    if (ci.IsPrefix(link.Attributes["href"].Value, "mailto"))
                    {
                        continue;
                    }
                    if (link.Attributes["href"].Value[0] == '/')
                    {
                        Uri uri = new Uri(url);

                        String _url;
                        if (uri.Port == 443)
                        {
                            _url = "https://";
                        }
                        else
                        {
                            _url = "http://";
                        }


                        _url += uri.Host;
                        _url += link.Attributes["href"].Value;

                        link.Attributes["href"].Value = _url;
                    }
                    else
                    {
                        link.Attributes["href"].Value = String.Concat(url + "/" + link.Attributes["href"].Value);
                    }
                }
                Links.Add(link);
            }
            bool diff = false;

            if (this.Links.Count == oldLinks.Count)
            {
                for (int i = 0; i < this.Links.Count; i++)
                {
                    if (this.Links[i].Attributes["href"].Value != oldLinks[i].Attributes["href"].Value)
                    {
                        diff = true;
                    }
                }
            }
            else
            {
                diff = true;
            }
            if (diff)
            {
                this.noChanges++;
                if (this.attachedViews.Count != 0 && this.attachedControllers.Count != 0)
                {
                    h(new object(), new updateViewOnChange(this.attachedViews, this.attachedControllers));
                }
            }
            return(true);
        }
Ejemplo n.º 27
0
 private void OnNew()
 {
     Links.Clear();
 }