public PlaceholdersExampleViewModel()
		{
			LocalLoadingPlaceholderExampleCommand = new PageFactoryCommand(() => {
				ErrorImagePath = null;
				LoadingImagePath = "loading.png";
				ImagePath = GetRandomImageUrl(width: 200, height: 200);
			});

			RemoteLoadingPlaceholderExampleCommand = new PageFactoryCommand(() => {
				ErrorImagePath = null;
				LoadingImagePath = "http://res.cloudinary.com/dqeaiomo8/image/upload/v1443461222/loading_xcotss.png";
				ImagePath = GetRandomImageUrl(width: 200, height: 200);
			});

			LocalErrorPlaceholderExampleCommand = new PageFactoryCommand(() => {
				ErrorImagePath = "error.png";
				LoadingImagePath = null;
				ImagePath = "http://notexisting.com/notexisting.jpg";
			});

			RemoteErrorPlaceholderExampleCommand = new PageFactoryCommand(() => {
				ErrorImagePath = "http://res.cloudinary.com/dqeaiomo8/image/upload/v1443461219/error_xxhxfn.png";
				LoadingImagePath = null;
				ImagePath = "http://notexisting.com/notexisting.jpg";
			}); 
		}
Exemple #2
0
        public PlaceholdersPageModel()
        {
            LocalLoadingCommand = new PageFactoryCommand(() => {
                ErrorImagePath   = null;
                LoadingImagePath = "loading.png";
                ImagePath        = GetRandomImageUrl(width: 200, height: 200);
            });

            RemoteLoadingCommand = new PageFactoryCommand(() => {
                ErrorImagePath   = null;
                LoadingImagePath = "http://res.cloudinary.com/dqeaiomo8/image/upload/v1443461222/loading_xcotss.png";
                ImagePath        = GetRandomImageUrl(width: 200, height: 200);
            });

            LocalErrorCommand = new PageFactoryCommand(() => {
                ErrorImagePath   = "error.png";
                LoadingImagePath = null;
                ImagePath        = "http://notexisting.com/notexisting.jpg";
            });

            RemoteErrorCommand = new PageFactoryCommand(() => {
                ErrorImagePath   = "http://res.cloudinary.com/dqeaiomo8/image/upload/v1443461219/error_xxhxfn.png";
                LoadingImagePath = null;
                ImagePath        = "http://notexisting.com/notexisting.jpg";
            });
        }
Exemple #3
0
        public ListViewModel()
        {
            DuplicateListItemsCommand = new PageFactoryCommand(() => {
                Items = new ObservableCollection <ListExampleItem>(Items.Concat(Items));
            });

            GenerateSampleData();
        }
        public ListExampleViewModel()
        {
            GenerateSampleData();

            DuplicateListItemsCommand = new PageFactoryCommand(() => {
                Items = new ObservableCollection<ListExampleItem>(Items.Concat(Items));
            });
        }
        public TransformationExampleViewModel()
        {
            ErrorImagePath = "error.png";
            LoadingImagePath = "loading.png";
            Transformations = null;

            BlurredTransformationExampleCommand = new PageFactoryCommand(() => {
                Transformations = new List<ITransformation>() {
                    new BlurredTransformation(10)
                };
                ImagePath = GetRandomImageUrl();
            });

            CircleTransformationExampleCommand = new PageFactoryCommand(() => {
                Transformations = new List<ITransformation>() {
                    new CircleTransformation()
                };
                ImagePath = GetRandomImageUrl();
            });

            ColorSpaceTransformationExampleCommand = new PageFactoryCommand(() => {
                Transformations = new List<ITransformation>() {
                    new ColorSpaceTransformation(FFColorMatrix.InvertColorMatrix)
                };
                ImagePath = GetRandomImageUrl();
            });

            GrayscaleTransformationExampleCommand = new PageFactoryCommand(() => {
                Transformations = new List<ITransformation>() {
                    new GrayscaleTransformation()
                };
                ImagePath = GetRandomImageUrl();
            });

            RoundedTransformationExampleCommand = new PageFactoryCommand(() => {
                Transformations = new List<ITransformation>() {
                    new RoundedTransformation(30)
                };
                ImagePath = GetRandomImageUrl();
            });

            SepiaTransformationExampleCommand = new PageFactoryCommand(() => {
                Transformations = new List<ITransformation>() {
                    new SepiaTransformation()
                };
                ImagePath = GetRandomImageUrl();
            });

            MultipleTransformationExampleCommand = new PageFactoryCommand(() => {
                Transformations = new List<ITransformation>() {
                    new ColorSpaceTransformation(FFColorMatrix.BlackAndWhiteColorMatrix),
                    new CircleTransformation()
                };
                ImagePath = GetRandomImageUrl();
            });
        }
Exemple #6
0
        public TransformationPageModel()
        {
            ErrorImagePath   = "error.png";
            LoadingImagePath = "loading.png";
            Transformations  = null;

            LoadAnotherImageCommand = new PageFactoryCommand(() => {
                ImagePath = GetRandomImageUrl();
            });
        }
		public TransformationExampleViewModel()
		{
			ErrorImagePath = "error.png";
			LoadingImagePath = "loading.png";
			Transformations = null;

			LoadAnotherImageCommand = new PageFactoryCommand(() => {
				ImagePath = GetRandomImageUrl();
			});
		}
        public HomeViewModel()
        {
            OpenSimpleExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<SimpleExampleViewModel>().PushPage());

            OpenListExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<ListExampleViewModel>().PushPage());

            OpenPlaceholdersExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<PlaceholdersExampleViewModel>().PushPage());
        }
		public DownsamplingExampleViewModel()
		{
			DownsampleHeight200ExampleCommand = new PageFactoryCommand(() => {
				DownsampleHeight = 200f;
				DownsampleWidth = 0f;
				ImagePath = GetRandomImageUrl(width: 1000, height: 500);
			});

			DownsampleWidth200ExampleCommand = new PageFactoryCommand(() => {
				DownsampleHeight = 0f;
				DownsampleWidth = 200f;	
				ImagePath = GetRandomImageUrl(width: 1000, height: 500);
			});
		}
        public DownsamplingExampleViewModel()
        {
            DownsampleHeight200ExampleCommand = new PageFactoryCommand(() => {
                DownsampleHeight = 200f;
                DownsampleWidth  = 0f;
                ImagePath        = GetRandomImageUrl(width: 1000, height: 500);
            });

            DownsampleWidth200ExampleCommand = new PageFactoryCommand(() => {
                DownsampleHeight = 0f;
                DownsampleWidth  = 200f;
                ImagePath        = GetRandomImageUrl(width: 1000, height: 500);
            });
        }
		public CropTransformationViewModel()
		{
			AddCurrentZoomFactorCommad = new PageFactoryCommand(() => {
				
				if (CurrentZoomFactor + 0.1d >= 1d)
					CurrentZoomFactor += 0.1d;
				ReloadImage();

			});

			SubCurrentZoomFactorCommad = new PageFactoryCommand(() => {

				if (CurrentZoomFactor - 0.1d >= 1d)
					CurrentZoomFactor -= 0.1d;
				ReloadImage();

			});

			AddCurrentXOffsetCommad = new PageFactoryCommand(() => {

				CurrentXOffset += 0.05d;
				ReloadImage();

			});

			SubCurrentXOffsetCommad = new PageFactoryCommand(() => {

				CurrentXOffset -= 0.05d;
				ReloadImage();

			});

			AddCurrentYOffsetCommad = new PageFactoryCommand(() => {

				CurrentYOffset += 0.05d;
				ReloadImage();

			});

			SubCurrentYOffsetCommad = new PageFactoryCommand(() => {

				CurrentYOffset -= 0.05d;
				ReloadImage();

			});
		}
Exemple #12
0
        public FlowListViewPageModel()
        {
            ModifyCollectionCommand = new PageFactoryCommand(() => {
                Items.RemoveAt(0);
                Items.RemoveAt(0);
                Items.RemoveAt(0);
                Items.RemoveAt(0);
                Items.RemoveAt(0);
            });

            ModifyCollectionItemsCommand = new PageFactoryCommand(() => {
                foreach (var item in Items)
                {
                    item.Title = Guid.NewGuid().ToString().Substring(0, 4);
                }
            });
        }
Exemple #13
0
        public CheckViewModel()
        {
            ModifyCollectionCommand = new PageFactoryCommand(() => {
            Items.RemoveAt(0);
            Items.RemoveAt(0);
            Items.RemoveAt(0);
            Items.RemoveAt(0);
            Items.RemoveAt(0);
            });

            ModifyCollectionItemsCommand = new PageFactoryCommand(() => {
                foreach (var item in Items)
                {
                    item.title = Guid.NewGuid().ToString().Substring(0, 4);
                }
            });
        }
        public FlowProductViewViewModel()
        {
            Items = new ObservableCollection<Product> ();
            ModifyCollectionCommand = new PageFactoryCommand(() => {
                Items.RemoveAt(0);
                Items.RemoveAt(0);
                Items.RemoveAt(0);
                Items.RemoveAt(0);
                Items.RemoveAt(0);
            });

            ModifyCollectionItemsCommand = new PageFactoryCommand(() => {
                foreach (var item in Items)
                {
                    item.title = Guid.NewGuid().ToString().Substring(0, 4);
                }
            });
        }
        public HomeViewModel()
        {
            OpenSimpleExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<SimpleExampleViewModel>().PushPage());

            OpenListExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<ListExampleViewModel>().PushPage());

            OpenListTransformationsExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<ListTransformationExampleViewModel>().PushPage());

            OpenPlaceholdersExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<PlaceholdersExampleViewModel>().PushPage());

            OpenTransformationsExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<TransformationExampleViewModel>().PushPage());

            OpenDownsamplingExampleCommand = new PageFactoryCommand(() =>
                PageFactory.GetMessagablePageFromCache<DownsamplingExampleViewModel>().PushPage());
        }
        public CropTransformationPageModel()
        {
            AddCurrentZoomFactorCommad = new PageFactoryCommand(() => {
                if (CurrentZoomFactor + 0.1d >= 1d)
                {
                    CurrentZoomFactor += 0.1d;
                }
                ReloadImage();
            });

            SubCurrentZoomFactorCommad = new PageFactoryCommand(() => {
                if (CurrentZoomFactor - 0.1d >= 1d)
                {
                    CurrentZoomFactor -= 0.1d;
                }
                ReloadImage();
            });

            AddCurrentXOffsetCommad = new PageFactoryCommand(() => {
                CurrentXOffset += 0.05d;
                ReloadImage();
            });

            SubCurrentXOffsetCommad = new PageFactoryCommand(() => {
                CurrentXOffset -= 0.05d;
                ReloadImage();
            });

            AddCurrentYOffsetCommad = new PageFactoryCommand(() => {
                CurrentYOffset += 0.05d;
                ReloadImage();
            });

            SubCurrentYOffsetCommad = new PageFactoryCommand(() => {
                CurrentYOffset -= 0.05d;
                ReloadImage();
            });
        }
		public ListPageModel()
		{
			DuplicateListItemsCommand = new PageFactoryCommand(() => {
				Items = new ObservableCollection<ListExampleItem>(Items.Concat(Items));
			});
		}
        public HomePageModel()
        {
            OpenTransformationExampleCommand = new PageFactoryCommand <Type>((transformationType) =>
                                                                             PageFactory.GetPageFromCache <TransformationPageModel>()
                                                                             .SendActionToPageModel((model) => model.ReloadTransformation(transformationType))
                                                                             .PushPage());

            var menuItems = new List <MenuItem>()
            {
                new MenuItem()
                {
                    Section = "Basic",
                    Title   = "Basic example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <SimplePageModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Basic",
                    Title   = "Basic XAML example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <SimpleXamlPageModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Basic",
                    Title   = "Placeholders examples",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <PlaceholdersPageModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Basic",
                    Title   = "Downsampling examples",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <DownsamplingPageModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Lists",
                    Title   = "List example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <ListPageModel>()
                                                     .SendActionToPageModel((model) => model.GenerateSampleData())
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Lists",
                    Title   = "List transformations example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <ListTransformPageModel>()
                                                     .SendActionToPageModel((model) => model.GenerateSampleData())
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Lists",
                    Title   = "Heavy Grid List example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <ListHeavyPageModel>()
                                                     .SendActionToPageModel((model) => model.GenerateSampleData())
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Advanced",
                    Title   = "Custom CacheKey example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <CustomCacheKeyPageModel>()
                                                     .SendActionToPageModel((model) => model.GenerateSampleData())
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Advanced",
                    Title   = "Stream with custom cache key example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <StreamPageModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Transformations",
                    Title   = "CropTransformation",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetPageFromCache <CropTransformationPageModel>()
                                                     .SendActionToPageModel((model) => model.Reload())
                                                     .PushPage()),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "RotateTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(RotateTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "CircleTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(CircleTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "RoundedTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(RoundedTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "CornersTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(CornersTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "GrayscaleTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(GrayscaleTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "BlurredTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(BlurredTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "SepiaTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(SepiaTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "ColorSpaceTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(ColorSpaceTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "FlipTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(FlipTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "Multiple transformations example",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = null,
                },
            };

            var sorted = menuItems
                         .GroupBy(item => item.Section)
                         .Select(itemGroup => new Grouping <string, MenuItem>(itemGroup.Key, itemGroup));

            MenuItems = new ObservableCollection <Grouping <string, MenuItem> >(sorted);
        }
Exemple #19
0
        public HomeViewModel()
        {
            OpenTransformationExampleCommand = new PageFactoryCommand <Type>((transformationType) =>
                                                                             PageFactory.GetMessagablePageFromCache <TransformationExampleViewModel>()
                                                                             .SendMessageToViewModel("LoadTransformation", this, transformationType)
                                                                             .PushPage());

            var menuItems = new List <MenuItem>()
            {
                new MenuItem()
                {
                    Section = "Basic",
                    Title   = "Basic example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <SimpleExampleViewModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Basic",
                    Title   = "Basic XAML example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <XamlSimpleExampleViewModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Lists",
                    Title   = "List example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <ListExampleViewModel>()
                                                     .SendMessageToViewModel("Reload")
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Lists",
                    Title   = "List transformations example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <ListTransformationExampleViewModel>()
                                                     .SendMessageToViewModel("Reload")
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Lists",
                    Title   = "Heavy Grid List example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <ListHeavyTestViewModel>()
                                                     .SendMessageToViewModel("Reload")
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Basic",
                    Title   = "Placeholders examples",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <PlaceholdersExampleViewModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Basic",
                    Title   = "Downsampling examples",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <DownsamplingExampleViewModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Advanced",
                    Title   = "Custom CacheKey example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <CustomCacheKeyViewModel>()
                                                     .SendMessageToViewModel("Reload")
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Advanced",
                    Title   = "Stream with custom cache key example",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <StreamTestViewModel>()
                                                     .PushPage())
                },

                new MenuItem()
                {
                    Section = "Transformations",
                    Title   = "CropTransformation",
                    Command = new PageFactoryCommand(() =>
                                                     PageFactory.GetMessagablePageFromCache <CropTransformationViewModel>()
                                                     .SendMessageToViewModel("Reload")
                                                     .PushPage()),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "RotateTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(RotateTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "CircleTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(CircleTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "RoundedTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(RoundedTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "CornersTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(CornersTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "GrayscaleTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(GrayscaleTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "BlurredTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(BlurredTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "SepiaTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(SepiaTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "ColorSpaceTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(ColorSpaceTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "FlipTransformation",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = typeof(FlipTransformation),
                },

                new MenuItem()
                {
                    Section          = "Transformations",
                    Title            = "Multiple transformations example",
                    Command          = OpenTransformationExampleCommand,
                    CommandParameter = null,
                },
            };

            var sorted = menuItems
                         .OrderBy(item => item.Section)
                         .ThenBy(item => item.Title)
                         .GroupBy(item => item.Section)
                         .Select(itemGroup => new Grouping <string, MenuItem>(itemGroup.Key, itemGroup));

            MenuItems = new ObservableCollection <Grouping <string, MenuItem> >(sorted);
        }