Example #1
0
 public DocumentationLink(DocumentationLinkType type, string url, string label)
 {
     Label = label ?? type.ToString();
     Url   = url;
     Type  = type;
     Open  = new AnotherCommandImplementation(Execute);
 }
 public DialogsViewModel()
 {
     //Sample 4
     OpenSample4DialogCommand = new AnotherCommandImplementation(OpenSample4Dialog);
     AcceptSample4DialogCommand = new AnotherCommandImplementation(AcceptSample4Dialog);
     CancelSample4DialogCommand = new AnotherCommandImplementation(CancelSample4Dialog);
 }
Example #3
0
        public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue)
        {
            _allItems = GenerateDemoItems(snackbarMessageQueue);
            FilterItems(null);

            MovePrevCommand = new AnotherCommandImplementation(
                _ =>
            {
                if (!string.IsNullOrWhiteSpace(SearchKeyword))
                {
                    SearchKeyword = string.Empty;
                }

                SelectedIndex--;
            },
                _ => SelectedIndex > 0);

            MoveNextCommand = new AnotherCommandImplementation(
                _ =>
            {
                if (!string.IsNullOrWhiteSpace(SearchKeyword))
                {
                    SearchKeyword = string.Empty;
                }

                SelectedIndex++;
            },
                _ => SelectedIndex < _allItems.Count - 1);
        }
 public DialogsViewModel()
 {
     //Sample 4
     OpenSample4DialogCommand   = new AnotherCommandImplementation(OpenSample4Dialog);
     AcceptSample4DialogCommand = new AnotherCommandImplementation(AcceptSample4Dialog);
     CancelSample4DialogCommand = new AnotherCommandImplementation(CancelSample4Dialog);
 }
        public IconPackViewModel()
        {
            OpenDotComCommand = new AnotherCommandImplementation(OpenDotCom);
            _packIconKinds = new Lazy<IEnumerable<PackIconKind>>(() =>
                Enum.GetValues(typeof (PackIconKind)).OfType<PackIconKind>()
                    .OrderBy(k => k.ToString(), StringComparer.InvariantCultureIgnoreCase).ToList()
                );

        }
Example #6
0
        public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue)
        {
            AllItems = GenerateDemoItems(snackbarMessageQueue);
            FilterItems(null);

            MovePrevCommand = new AnotherCommandImplementation(
                _ => SelectedIndex--,
                _ => SelectedIndex > 0);

            MoveNextCommand = new AnotherCommandImplementation(
                _ => SelectedIndex++,
                _ => SelectedIndex < AllItems.Count - 1);
        }
        public TreesViewModel()
        {
            MovieCategories = new ObservableCollection <MovieCategory>
            {
                new MovieCategory("Action",
                                  new Movie("Predator", "John McTiernan"),
                                  new Movie("Alien", "Ridley Scott"),
                                  new Movie("Prometheus", "Ridley Scott")),
                new MovieCategory("Comedy",
                                  new Movie("EuroTrip", "Jeff Schaffer"),
                                  new Movie("EuroTrip", "Jeff Schaffer")
                                  )
            };

            AddCommand = new AnotherCommandImplementation(
                _ =>
            {
                if (!MovieCategories.Any())
                {
                    MovieCategories.Add(new MovieCategory(GenerateString(15)));
                }
                else
                {
                    var index = new Random().Next(0, MovieCategories.Count);

                    MovieCategories[index].Movies.Add(
                        new Movie(GenerateString(15), GenerateString(20)));
                }
            });

            RemoveSelectedItemCommand = new AnotherCommandImplementation(
                _ =>
            {
                var movieCategory = SelectedItem as MovieCategory;
                if (movieCategory != null)
                {
                    MovieCategories.Remove(movieCategory);
                }
                else
                {
                    var movie = SelectedItem as Movie;
                    if (movie == null)
                    {
                        return;
                    }
                    MovieCategories.FirstOrDefault(v => v.Movies.Contains(movie))?.Movies.Remove(movie);
                }
            },
                _ => SelectedItem != null);
        }
 public ListsAndGridsViewModel()
 {
     _items1     = CreateData();
     _items2     = CreateData();
     _items3     = CreateData();
     collectionA = new ObservableCollection <TestClass>();
     collectionB = new ObservableCollection <TestClass>();
     collectionA.Add(new TestClass("one"));
     collectionA.Add(new TestClass("two"));
     collectionA.Add(new TestClass("three"));
     collectionB.Add(new TestClass("one"));
     collectionB.Add(new TestClass("two"));
     collectionB.Add(new TestClass("three"));
     Click = new AnotherCommandImplementation(Clear);
 }
        public TreesViewModel()
        {
            MovieCategories = new ObservableCollection<MovieCategory>
            {
                new MovieCategory("Action",                
                    new Movie ("Predator", "John McTiernan"),
                    new Movie("Alien", "Ridley Scott"),
                    new Movie("Prometheus", "Ridley Scott")),
                new MovieCategory("Comedy",
                    new Movie("EuroTrip", "Jeff Schaffer"),
                    new Movie("EuroTrip", "Jeff Schaffer")                                            
                )
            };

            AddCommand = new AnotherCommandImplementation(
                _ =>
                {
                    if (!MovieCategories.Any())
                    {
                        MovieCategories.Add(new MovieCategory(GenerateString(15)));
                    }
                    else
                    {
                        var index = new Random().Next(0, MovieCategories.Count);

                        MovieCategories[index].Movies.Add(
                            new Movie(GenerateString(15), GenerateString(20)));
                    }
                });

            RemoveSelectedItemCommand = new AnotherCommandImplementation(
                _ =>
                {
                    var movieCategory = SelectedItem as MovieCategory;
                    if (movieCategory != null)
                    {
                        MovieCategories.Remove(movieCategory);
                    }
                    else
                    {
                        var movie = SelectedItem as Movie;
                        if (movie == null) return;
                        MovieCategories.FirstOrDefault(v => v.Movies.Contains(movie))?.Movies.Remove(movie);
                    }
                },
                _ => SelectedItem != null);
        }
        public Buttons()
        {
            InitializeComponent();

            FloatingActionDemoCommand = new AnotherCommandImplementation(Execute);
        }
 public ProvingGroundViewModel()
 {
     ClearItems = new AnotherCommandImplementation(_ => Items.Clear());
 }