Example #1
0
        public void Show()
        {
            if (ComponentShelf == null)
            {
                try
                {
                    IDesktopWindow desktopWindow = Context.DesktopWindow;

                    ImagePropertiesApplicationComponent component =
                        new ImagePropertiesApplicationComponent(Context.DesktopWindow);

                    IShelf shelf = ApplicationComponent.LaunchAsShelf(Context.DesktopWindow, component,
                                                                      SR.TitleImageProperties, "ImageProperties", ShelfDisplayHint.DockLeft);

                    Shelves.Add(Context.DesktopWindow, shelf);
                    shelf.Closed += delegate { Shelves.Remove(desktopWindow); };
                }
                catch (Exception e)
                {
                    ExceptionHandler.Report(e, Context.DesktopWindow);
                }
            }
            else
            {
                ComponentShelf.Show();
            }
        }
Example #2
0
        public Shelf AddShelf(string name)
        {
            var shelf = new Shelf {
                Name = name
            };

            Shelves.Add(shelf);
            return(shelf);
        }
Example #3
0
        private void LoadShelves()
        {
            Shelf shelf;

            foreach (string topic in Topics)
            {
                shelf = new Shelf(topic);
                Shelves.Add(shelf);
            }
        }
Example #4
0
        public static void Test1()
        {
            List<string> testBuffer = new List<string> {
                " - 1 on shelf 1 - ",
                " - 2 on shelf 1 - ",
                " - 3 on shelf 2 - ",
                " - 4 on shelf 2 - ",
                " - 5 on shelf 2 - ",
                " - 6 on shelf 3 - ",
                " - 7 on shelf 3 - ",
                " - 8 on shelf 4 - ",
                " - 9 on shelf 4 - ",
                " - 0 on shelf 10 - "};

            IShelves<string> c = new Shelves<string>();
            c.Add(1, testBuffer[0]);
            c.Add(1, testBuffer[1]);
            c.Add(2, testBuffer[2]);
            c.Add(2, testBuffer[3]);
            c.Add(2, testBuffer[4]);
            c.Add(3, testBuffer[5]);
            c.Add(3, testBuffer[6]);
            c.Add(4, testBuffer[7]);
            c.Add(4, testBuffer[8]);
            c.Add(10, testBuffer[9]);

            // output: everything from every shelf
            int i = 0;
            foreach (var item in c)
            {
                Assert.AreEqual(item[4], testBuffer[i][4]);
                ++i;
            }

            var it = c.GetEnumeratorForLevel(2);
            i = 0;
            while (it.MoveNext())
            {
                Assert.AreEqual(it.Current[4], testBuffer[i][4]);
                ++i;
            }
        }
Example #5
0
 /// <summary>
 /// Adds a shelf, that has already been instantiated, to the collection
 /// </summary>
 /// <param name="shelf"></param>
 public void Add(Shelf shelf)
 {
     shelf.ColorValues           = new ObservableCollection <string>(GetColorValues());
     shelf.WidthValues           = new ObservableCollection <string>(GetWidthValues());
     shelf.DepthValues           = new ObservableCollection <string>(GetDepthValues());
     shelf.ShelfTypeValues       = new ObservableCollection <string>(GetShelfTypeNames());
     shelf.viewmodel             = this;
     shelf.Wood.WoodValues       = GetWoodValues();
     shelf.Banding.BandingValues = GetBandingValues();
     TotalQuantity         += shelf.Quantity;
     shelf.PropertyChanged += Shelf_PropertyChanged;
     Shelves.Add(shelf);
 }
Example #6
0
        public override async void OnNavigatingTo(NavigationParameters parameters)
        {
            base.OnNavigatingTo(parameters);

            var shelf = await WebClient.Client.ListShelvesAsync();

            ObservableCollection <string> temp = new ObservableCollection <string>(shelf);

            Shelves.Clear();
            foreach (string s in temp)
            {
                Shelves.Add(s);
            }
        }
Example #7
0
        private async void AddShelf()
        {
            var dialog = new InputDialogViewModel
            {
                Title   = "Adding Shelf",
                Message = "Enter name",
                Hint    = "Shelf Name"
            };
            var result = (bool)await DialogManager.ShowInputDialogAsync(dialog);

            if (result)
            {
                var shelf = state_manager.CurrentCollection.AddShelf(dialog.Input);
                var vm    = new ShelfViewModel(shelf);
                Shelves.Add(vm);
            }
        }
Example #8
0
        private void PopulateData(User friend)
        {
            Id = friend.Id;
            Name = friend.Name;
            ImageUrl = friend.ImageUrl;
            Link = friend.Link;
            Age = friend.Age;
            About = friend.About;
            Gender = friend.Gender;
            Location = friend.Location;
            Website = friend.Website;
            Joined = friend.Joined;
            LastActive = friend.LastActive;
            Interests = friend.Interests;
            FavouriteBooks = friend.FavoriteBooks;
            FriendsCount = $"{friend.FriendsCount} Friends";
            BooksCount = $"{friend.ReviewsCount} Books";
            GroupsCount = $"{friend.GroupsCount} Groups";

            //Task.Run( async () =>
            try
            {
                CurrentlyReading.Clear();
                if (friend.UserStatuses != null && friend.UserStatuses.Count > 0)
                {
                    foreach (var userStatus in friend.UserStatuses)
                        CurrentlyReading.Add(new UserStatusViewModel(userStatus));
                }

                Updates.Clear();
                if (friend.Updates != null && friend.Updates.Update != null && friend.Updates.Update.Count > 0)
                {
                    foreach (var userUpdate in friend.Updates.Update)
                        Updates.Add(new UpdateViewModel(userUpdate));
                }

                Shelves.Clear();
                if (friend.UserShelves != null && friend.UserShelves.Count > 0)
                {
                    foreach (var shelf in friend.UserShelves)
                        Shelves.Add(new ShelfViewModel(shelf));
                }
            }//);
            catch { }
        }
Example #9
0
        private async void Add()
        {
            if (NewShelf.Trim() != "")
            {
                await WebClient.Client.AddNewShelf(NewShelf);

                NewShelf = "";

                var shelf = await WebClient.Client.ListShelvesAsync();

                ObservableCollection <string> temp = new ObservableCollection <string>(shelf);
                Shelves.Clear();
                foreach (string s in temp)
                {
                    Shelves.Add(s);
                }
            }
        }
Example #10
0
        /// <summary>
        /// Adds a shelf to the collection
        /// </summary>
        /// <param name="RoomNumber"></param>
        /// <param name="Color"></param>
        /// <param name="SizeDepth"></param>
        public void Add(int RoomNumber, string Color = null, string SizeDepth = null)
        {
            bool HasColor = false;
            bool HasDepth = false;

            if (Color != null)
            {
                HasColor = true;
            }
            HasDepth |= SizeDepth != null;

            Shelf shelf = new Shelf(
                RoomNumber,
                HasColor ? Color : null,
                HasDepth ? SizeDepth : null)
            {
                ColorValues     = new ObservableCollection <string>(GetColorValues()),
                WidthValues     = new ObservableCollection <string>(GetWidthValues()),
                DepthValues     = new ObservableCollection <string>(GetDepthValues()),
                ShelfTypeValues = new ObservableCollection <string>(GetShelfTypeNames()),
                viewmodel       = this
            };

            shelf.Wood.WoodValues       = GetWoodValues();
            shelf.Banding.BandingValues = GetBandingValues();

            TotalQuantity += 1;

            shelf.PropertyChanged += Shelf_PropertyChanged;

            if (Color != null)
            {
                Color_PropertyChanged(shelf);
            }
            Shelves.Add(shelf);
        }