/// <summary>
        /// Schreibt die Werte aus dem Speicher in die Datei und schließt die Datei
        /// </summary>
        public void Close()
        {
            Flush();

            Pfad = null;
            Contents.Clear();
        }
Exemple #2
0
        public Folder(string name, string path, ErrorState errorState)
        {
            Name       = name;
            Path       = path;
            ErrorState = errorState;

            Contents.Clear();
            System.IO.Directory.GetFiles(Path).ToList().ForEach(x => Contents.Add(System.IO.Path.GetFileName(x)));
            _watcher          = new FileSystemWatcher(Path);
            _watcher.Created += (sender, e) =>
            {
                App.Current.Dispatcher.Invoke(delegate
                {
                    Contents.Add(e.Name);
                });
            };

            _watcher.Deleted += (sender, e) =>
            {
                if (!Contents.Any(x => x == e.Name))
                {
                    return;
                }

                App.Current.Dispatcher.Invoke(delegate
                {
                    Contents.Remove(e.Name);
                });
            };
            _watcher.EnableRaisingEvents = true;
        }
        private void UpdateContents(System.Collections.Specialized.NotifyCollectionChangedEventArgs e, ContentCollection collection)
        {
            lock (collection.ContentLock)
            {
                if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
                {
                    Contents.Clear();
                    contentViewModels.Clear();
                }

                if (e.OldItems != null)
                {
                    foreach (Content remItem in e.OldItems)
                    {
                        Contents.Remove(remItem);
                        contentViewModels.Remove(remItem);
                    }
                }
                if (e.NewItems != null)
                {
                    foreach (Content addItem in e.NewItems)
                    {
                        Contents.Add(addItem);
                        //contentViewModels.Add(addItem, new ContentControlViewModel(addItem));
                    }
                }
            }
        }
Exemple #4
0
        async Task ExecuteLoadItemsCommand()
        {
            try
            {
                UserDialogService.ShowLoading("查询中");
                Contents.Clear();
                var result = await PosSDK.CallAPI <ListResult <Sku> >("/catalog/search-skus", new
                {
                    q = SearchText
                });

                Contents.ReplaceRange(result.Result.Items);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                MessagingCenter.Send(new MessagingCenterAlert
                {
                    Title   = "Error",
                    Message = "Unable to load items.",
                    Cancel  = "OK"
                }, "message");
            }
            finally
            {
                UserDialogService.HideLoading();
            }
        }
Exemple #5
0
        protected override void LoadSettings(BagInstance Data)
        {
            if (Data != null)
            {
                this.Size     = Data.Size;
                this.Autofill = Data.Autofill;

                this.BaseName         = ItemBagsMod.Translate("BundleBagName");
                this.DescriptionAlias = ItemBagsMod.Translate("BundleBagDescription");

                Contents.Clear();
                foreach (BagItem Item in Data.Contents)
                {
                    this.Contents.Add(Item.ToObject());
                }

                if (Data.IsCustomIcon)
                {
                    this.CustomIconSourceTexture   = BagType.SourceTexture.SpringObjects;
                    this.CustomIconTexturePosition = Data.OverriddenIcon;
                }
                else
                {
                    ResetIcon();
                }
            }
        }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Contents.Clear();
                var result = await PosSDK.CallAPI <ListResult <Content> >("/catalog/search-contents");

                Contents.ReplaceRange(result.Result.Items);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                MessagingCenter.Send(new MessagingCenterAlert
                {
                    Title   = "Error",
                    Message = "Unable to load items.",
                    Cancel  = "OK"
                }, "message");
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #7
0
        public override void Update()
        {
            Contents.Clear();
            var hh = new HeaderHelper();

            Search(Base, hh);
            base.Update();
        }
Exemple #8
0
 /// <summary>
 /// 设置选择集内容
 /// </summary>
 /// <param name="entity">实体</param>
 public static void Select(IFeature entity)
 {
     UnmarkSelection();
     Contents.Clear();
     Contents.Add(entity);
     MarkSelection();
     OnSelectionChanged();
 }
Exemple #9
0
 /// <summary>
 /// 设置选择集内容
 /// </summary>
 /// <param name="entities">实体数组</param>
 public static void Select(IFeature[] entities)
 {
     UnmarkSelection();
     Contents.Clear();
     entities.ToList().ForEach(x => Contents.Add(x));
     MarkSelection();
     OnSelectionChanged();
 }
Exemple #10
0
 private void Display_Favoris(object send, RoutedEventArgs e)
 {
     Contents.Clear();
     foreach (var favoris in Favoris)
     {
         Contents.Add(favoris);
     }
     favoriteDisplay = true;
 }
 public async Task LoadAsync()
 {
     var contents = await _monkeyHubApiService.GetContentsByTagIdAsync(_tag.Id);
     Contents.Clear();
     foreach (var content in contents)
     {
         Contents.Add(content);
     }
 }
 public void Clear()
 {
     lock (Contents)
     {
         CurrentIndex = -1;
         Contents.Clear();
         lyric    = null;
         HasLyric = false;
     }
 }
Exemple #13
0
        //Método para popular a ObservableCollection no override do evento OnAppearing da página de categoria.
        public async Task LoadAsync()
        {
            var contents = await _service.GetContentsByTagIdAsync(_tag.Id);

            Contents.Clear();

            foreach (var item in contents)
            {
                Contents.Add(item);
            }
        }
Exemple #14
0
        /// <summary>
        /// Discards all elements from the table.  Unlike a <see cref="IHand{TElement}"/>, the table persists
        /// after this operation.
        /// </summary>
        /// <returns>The table (for fluent purposes).</returns>
        public ITable <TElement> Muck()
        {
            Deck.Events.Mucking(this);

            ((IDeckStackInternal <TElement>) this).CheckEnabled();
            Contents.Apply(c => Deck.DiscardPileStack.Add(c));
            Contents.Clear();

            Deck.Events.Mucked(this);

            return(this);
        }
        private void SetPowerUpContents()
        {
            Contents.Clear();

            int powerUpIndex = (int)Random.Generator.Next(_powerUpTextureNames.Count);

            Contents.Add(new Data.SmashBlockItemData()
            {
                TextureName = _powerUpTextureNames[powerUpIndex],
                Count       = 1,
                AffectsItem = Data.SmashBlockItemData.AffectedItem.PowerUp,
                Value       = powerUpIndex
            });
        }
Exemple #16
0
        /// <summary>
        /// Clear entire repository.
        /// </summary>
        /// <returns></returns>
        public virtual bool Clear()
        {
            String fn = MethodBase.GetCurrentMethod().Name;

            try
            {
                Contents.Clear();
                return(true);
            }
            catch (Exception exc)
            {
                Util.HandleExc(this, fn, exc);
                return(false);
            }
        }
Exemple #17
0
        private void SearchMethod()
        {
            if (String.IsNullOrEmpty(Keyword) && Contents != null)
            {
                Contents.Clear();
            }
            if (String.IsNullOrEmpty(Keyword) && People != null)
            {
                People.Clear();
            }

            Contents = new IncrementalLoading <SearchItem>(GetMoreContents,
                                                           "search?t=union&q={0}", FirstOffset, false);

            People = new IncrementalLoading <Author>(GetMorePeople,
                                                     "search?t=people&q={0}", FirstOffset, false);
        }
Exemple #18
0
        protected override void LoadSettings(BagInstance Data)
        {
            if (Data != null)
            {
                this.Size = Data.Size;

                string SizeName = ItemBagsMod.Translate(string.Format("Size{0}Name", Size.GetDescription()));
                DescriptionAlias = string.Format("{0}\n({1})\n({2})",
                                                 ItemBagsMod.Translate("OmniBagDescription"),
                                                 ItemBagsMod.Translate("CapacityDescription", new Dictionary <string, string>()
                {
                    { "count", MaxStackSize.ToString() }
                }),
                                                 ItemBagsMod.Translate("OmniBagCapacityDescription", new Dictionary <string, string>()
                {
                    { "size", SizeName }
                })
                                                 );

                this.NestedBags.Clear();
                foreach (BagInstance NestedInstance in Data.NestedBags)
                {
                    if (NestedInstance.TryDecode(out ItemBag NestedBag))
                    {
                        this.NestedBags.Add(NestedBag);
                    }
                }

                Contents.Clear();
                foreach (BagItem Item in Data.Contents)
                {
                    this.Contents.Add(Item.ToObject());
                }

                if (Data.IsCustomIcon)
                {
                    this.CustomIconSourceTexture   = BagType.SourceTexture.SpringObjects;
                    this.CustomIconTexturePosition = Data.OverriddenIcon;
                }
                else
                {
                    ResetIcon();
                }
            }
        }
Exemple #19
0
        private bool disposedValue = false; // To detect redundant calls

        /// <summary>
        /// For a hand, this is mucking the hand.
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    Deck.Events.Mucking(this);

                    Contents.Apply(c => Deck.DiscardPileStack.Add(c));
                    Contents.Clear();
                    HasBeenMucked = true;
                    Deck.RemoveHand(this);

                    Deck.Events.Mucked(this);
                }
                disposedValue = true;
            }
        }
 public void New(Lyric l)
 {
     lock (Contents)
     {
         CurrentIndex = -1;
         Contents.Clear();
         if (l == null || l == default(Lyric))
         {
             HasLyric = false;
             return;
         }
         lyric = l;
         foreach (var item in l)
         {
             Contents.Add(new LrcContent()
             {
                 Content = item.Value
             });
         }
         HasLyric = true;
     }
 }
        /// <summary>
        /// Updates contents from Organization based on selected folder.
        /// </summary>
        public void UpdateContent()
        {
            // Save current selection from listview
            Content currentSel = this.SelectedContent;

            // Get selected folder
            ContentRootFolder folderName = this.SelectedFolder;

            // Get root folders
            bool recursive;
            List <ContentRootFolder> selRootFolders = GetFilteredRootFolders(out recursive);

            bool            genreFilterEnable;
            GenreCollection genreFilter = GetSelectedGenres(out genreFilterEnable);

            // Set contents for listview
            List <Content> contents = Organization.GetContentFromRootFolders(selRootFolders, recursive, genreFilterEnable, genreFilter, this.YearFilterEnable, this.YearFilterStart, this.YearFilterStop, this.NameFilter);

            Contents.Clear();
            foreach (Content content in contents)
            {
                this.Contents.Add(content);
            }
        }
Exemple #22
0
 /// <summary>
 /// CSVから読み込んだ一時データを削除します
 /// </summary>
 public void Clear()
 {
     Headers.Clear();
     Contents.Clear();
 }
 public void Clear()
 {
     Contents.Clear();
     SaveList();
 }
        /// <summary>
        /// Load the category definitions from a specified file.
        /// </summary>
        /// <returns>True if the file has been loaded; false otherwise.</returns>
        public static bool Load(string fileName)
        {
            Logger.Instance.Write("Loading EIT Program Categories from " + fileName);

            FileStream fileStream = null;

            try { fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); }
            catch (IOException e)
            {
                Logger.Instance.Write("Program categories file " + fileName + " not available");
                Logger.Instance.Write(e.Message);
                return(false);
            }

            Contents.Clear();
            undefinedContents = null;

            StreamReader streamReader = new StreamReader(fileStream, Encoding.UTF8);

            while (!streamReader.EndOfStream)
            {
                string line = streamReader.ReadLine();

                if (line.Trim() != string.Empty && line[0] != '#')
                {
                    string[] parts = line.Split(new char[] { '=' });
                    if (parts.Length < 2)
                    {
                        Logger.Instance.Write("Program category line '" + line + "' format wrong - line ignored ");
                    }
                    else
                    {
                        try
                        {
                            string[] numbers = parts[0].Split(new char[] { ',' });
                            if (numbers.Length != 2)
                            {
                                Logger.Instance.Write("Program category line '" + line + "' format wrong - line ignored ");
                            }
                            else
                            {
                                int contentID    = Int32.Parse(numbers[0].Trim());
                                int subContentID = Int32.Parse(numbers[1].Trim());
                                AddContent(contentID, subContentID, line.Substring(parts[0].Length + 1));
                            }
                        }
                        catch (FormatException)
                        {
                            Logger.Instance.Write("Program category line '" + line + "' number wrong - line ignored ");
                        }
                        catch (ArithmeticException)
                        {
                            Logger.Instance.Write("Program category line '" + line + "' number wrong - line ignored ");
                        }
                    }
                }
            }

            streamReader.Close();
            fileStream.Close();

            if (contents != null)
            {
                Logger.Instance.Write("Loaded " + contents.Count + " program category entries");
            }
            else
            {
                Logger.Instance.Write("No program category entries loaded");
            }

            return(true);
        }
Exemple #25
0
 public void CancelOrder()
 {
     Contents.Clear();
 }
Exemple #26
0
 public void ClearContents()
 {
     Contents.Clear();
 }
        public void ConsolidateConnections()
        {
            // Ensure components consuming composition inputs/outputs have a source

            // Find connections that are consumed by internal components but are not provided by external components
            var neglectedInternalConnections = from c in Connections
                                               where c.Source == this
                                               where Contents.Contains(c.Destination)
                                               where !Connections.Any(con => con.DestinationInput == c.SourceOutput)
                                               select c;

            if (neglectedInternalConnections.Any())
            {
                throw new NoProvidingSourceException(Name, from c in neglectedInternalConnections select c.SourceOutput);
            }

            // Find connections that are consumed by external components but are not provided by internal components
            var neglectedExternalConnections = from c in Connections
                                               where c.Source == this
                                               where c.Destination != this
                                               where !Contents.Contains(c.Destination)
                                               where !Connections.Any(con => con.DestinationInput == c.SourceOutput)
                                               select c;

            if (neglectedExternalConnections.Any())
            {
                throw new NoProvidingSourceException(Name, from c in neglectedExternalConnections select c.SourceOutput);
            }

            // Begin consolidating composition connections

            // First, consolidate the connections leading into the composition
            var incomingConnections = from c in Connections
                                      where c.Destination == this
                                      where c.Source != this
                                      where !Contents.Contains(c.Source)
                                      select c;

            foreach (var connection in incomingConnections)
            {
                // Find all of the places this input is consumed
                var destinationConnections = from c in Connections
                                             where c.Source == this
                                             where c.SourceOutput == connection.DestinationInput
                                             select c;

                foreach (var destinationConnection in destinationConnections)
                {
                    var trueDestinations = Enumerable.Repeat(destinationConnection, 1);

                    // If the input passes through straight to an output, connect the input to the external components
                    if (destinationConnection.Destination == this)
                    {
                        trueDestinations = from c in Connections
                                           where c.Source == this
                                           where c.SourceOutput == destinationConnection.DestinationInput
                                           select c;
                    }

                    // Connect the source to the current destination and remove the destination's connection to the composition
                    foreach (var trueDestination in trueDestinations)
                    {
                        connection.Source.Connect(trueDestination.Destination, connection.SourceOutput, trueDestination.DestinationInput, connection.ConnectionType);
                        trueDestination.Destination.Connections.Remove(trueDestination);
                    }
                }

                // Remove the source's connection to the composition
                connection.Source.Connections.Remove(connection);
            }

            // Then, consolidate the connections leading out of the composition
            var outgoingConnections = from c in Connections
                                      where c.Destination == this
                                      where Contents.Contains(c.Source)
                                      select c;

            foreach (var connection in outgoingConnections)
            {
                var destinationConnections = from c in Connections
                                             where c.Source == this
                                             where c.SourceOutput == connection.DestinationInput
                                             select c;

                foreach (var destinationConnection in destinationConnections)
                {
                    connection.Source.Connect(destinationConnection.Destination, connection.SourceOutput, destinationConnection.DestinationInput, connection.ConnectionType);
                    destinationConnection.Destination.Connections.Remove(destinationConnection);
                }

                connection.Source.Connections.Remove(connection);
            }

            // Remove all connections and content from the composition
            Connections.Clear();
            Contents.Clear();
        }
 public virtual void ClearContents()
 {
     Contents.Clear();
 }
Exemple #29
0
        private async void onTextChangedSearch(object sender, RoutedEventArgs e)
        {
            favoriteDisplay = false;
            string search = searching.Text;

            Contents.Clear();
            var endpoint = new GalleryEndpoint(client);

            Imgur.API.Enums.ImageFileType?Filetype = null;
            if (type.Text == "Jpg")
            {
                Filetype = Imgur.API.Enums.ImageFileType.Jpg;
            }
            else if (type.Text == "Png")
            {
                Filetype = Imgur.API.Enums.ImageFileType.Png;
            }
            else if (type.Text == "Gif")
            {
                Filetype = Imgur.API.Enums.ImageFileType.Gif;
            }
            else if (type.Text == "Anigif")
            {
                Filetype = Imgur.API.Enums.ImageFileType.Anigif;
            }

            Imgur.API.Enums.ImageSize?Fileformat = null;
            if (format.Text == "Small")
            {
                Fileformat = Imgur.API.Enums.ImageSize.Small;
            }
            else if (format.Text == "Medium")
            {
                Fileformat = Imgur.API.Enums.ImageSize.Med;
            }
            else if (format.Text == "Big")
            {
                Fileformat = Imgur.API.Enums.ImageSize.Big;
            }
            else if (format.Text == "Large")
            {
                Fileformat = Imgur.API.Enums.ImageSize.Lrg;
            }
            else if (format.Text == "Huge")
            {
                Fileformat = Imgur.API.Enums.ImageSize.Huge;
            }

            if (search == "")
            {
                return;
            }
            while (CheckForInternetConnection() == false)
            {
                ;
            }
            var gallerys = await endpoint.SearchGalleryAdvancedAsync(search, null, null, null, Filetype, Fileformat, Imgur.API.Enums.GallerySortOrder.Time);

            foreach (var gallery in gallerys)
            {
                if (gallery.GetType() != typeof(Imgur.API.Models.Impl.GalleryAlbum))
                {
                    Imgur.API.Models.Impl.GalleryImage tip = (Imgur.API.Models.Impl.GalleryImage)gallery;
                    ListBoxContent content = new ListBoxContent();
                    content.Url = tip.Link;
                    Contents.Add(content);
                    continue;
                }
                Imgur.API.Models.Impl.GalleryAlbum tmp = (Imgur.API.Models.Impl.GalleryAlbum)gallery;
                foreach (var image in tmp.Images)
                {
                    ListBoxContent content = new ListBoxContent();
                    content.Url = image.Link;
                    Contents.Add(content);
                }
            }
        }
 /// <summary>
 /// Clears the deck.
 /// </summary>
 public void ClearDeck()
 {
     Contents.Clear();
 }