예제 #1
0
        public MovieListViewModel(IService service)
        {
            Service = service;

            MovieFilter   = new MovieFilter();
            SelectedMovie = null;
            NewMovie      = null;
            NewActor      = null;
            NewDirector   = null;

            MovieFilterCommand              = new FilterCommand(this);
            NewMovieCommand                 = new NewItemCommand(this);
            CancelNewMovieCommand           = new CancelNewItemCommand(this);
            SaveMovieCommand                = new SaveMovieCommand(this);
            DownloadPosterFromWebApiCommand = new DownloadPosterFromWebApiCommand(this);

            AddGenreCommand    = new AddGenreCommand(this);
            AddCountryCommand  = new AddCountryCommand(this);
            AddDirectorCommand = new AddDirectorCommand(this);
            AddActorCommand    = new AddActorCommand(this);

            NewDirectorCommand       = new NewDirectorCommand(this);
            NewActorCommand          = new NewActorCommand(this);
            CancelNewActorCommand    = new CancelNewActorCommand(this);
            CancelNewDirectorCommand = new CancelNewDirectorCommand(this);
            SaveActorCommand         = new SaveActorCommand(this);
            SaveDirectorCommand      = new SaveDirectorCommand(this);

            RemoveMovieCommand = new RemoveMovieCommand(this);

            Genres    = new ObservableCollection <Genre>();
            Countries = new ObservableCollection <Country>();
            Directors = new ObservableCollection <Director>();
            Actors    = new ObservableCollection <Actor>();
        }
예제 #2
0
 public MainAppPageVM(INavigationService navigationService)
 {
     CustomerCommand        = new NewCustomerCommand(this);
     ItemCommand            = new NewItemCommand(this);
     ProviderCommand        = new NewProviderCmd(this);
     QuoteCommand           = new NewQuoteCmd(this);
     this.navigationService = navigationService;
 }
        public ProjectFolderViewModel(IProjectFolder model)
            : base(model)
        {
            shell = IoC.Get <IShell>();

            Items = new ObservableCollection <ProjectItemViewModel>();
            Items.BindCollections(model.Items, p => { return(Create(p)); }, (pivm, p) => pivm.Model == p);

            NewItemCommand = ReactiveCommand.Create();
            NewItemCommand.Subscribe(_ =>
            {
                shell.ModalDialog = new NewItemDialogViewModel(model);
                shell.ModalDialog.ShowDialog();
            });

            RemoveCommand = ReactiveCommand.Create();
            RemoveCommand.Subscribe(_ => { model.Project.ExcludeFolder(model); });
        }
예제 #4
0
 public void handleNewItemCommand(NewItemCommand newItemCommand)
 {
     int sourceId=-1;
     int sourceClassId=-1;
     String sourceClassName="";
     try{
     sourceId=newItemCommand.getSourceId();
     sourceClassId=newItemCommand.getSourceClassId();
     sourceClassName=modelManager.getStringFromInteger(sourceClassId);
     Type sourceClass=Type.GetType(sourceClassName);
     Persisted dbPersisted = (Persisted) injector.create(sourceClass);
     dbPersisted.setPlanckDBId(sourceId);
     registry.insert(sourceClassId,dbPersisted);
     } catch (Exception e) {
     newItemCommand.setCommandSatus(CommandStatus.failOnCreatingNewItem);
     log.Error(CommandStatus.failOnCreatingNewItem.getMessage() + "item class = "+sourceClassName+" item id = "+ sourceId ,e);
     }
 }
예제 #5
0
        private void AutoCompleteBox_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Up || e.Key == Key.Down || e.Key == Key.Enter)
            {
                if (FilteredItems != null && FilteredItems.Count > 0)
                {
                    var cview  = CollectionViewSource.GetDefaultView(FilteredItems);
                    var curPos = cview.CurrentPosition;

                    if (e.Key == Key.Down && curPos < FilteredItems.Count - 1)
                    {
                        cview.MoveCurrentToNext();
                    }
                    if (e.Key == Key.Up && curPos > 0)
                    {
                        cview.MoveCurrentToPrevious();
                    }
                    if (e.Key == Key.Enter && SelectCommand != null)
                    {
                        SelectItem(cview.CurrentItem);
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(Text) && e.Key == Key.Enter)
                    {
                        if (NewItemCommand != null)
                        {
                            NewItemCommand.Execute(null);
                            SelectAll();
                        }
                    }
                }
            }
            else
            {
                if (e.Key == Key.Escape)
                {
                    Text = String.Empty;
                }

                FilterItems();
            }
        }
예제 #6
0
        public ProjectViewModel(SolutionViewModel solutionViewModel, IProject model)
            : base(model)
        {
            shell = IoC.Get <IShell>();

            Items = new ObservableCollection <ProjectItemViewModel>();

            Items.BindCollections(model.Items, p => { return(ProjectItemViewModel.Create(p)); }, (pivm, p) => pivm.Model == p);

            ConfigureCommand = ReactiveCommand.Create();

            ConfigureCommand.Subscribe(o =>
            {
                if (configuration == null)
                {
                    configuration = new ProjectConfigurationDialogViewModel(model, () =>
                    {
                        configuration = null;
                    });

                    shell.AddDocument(configuration);
                }
                else
                {
                    shell.SelectedDocument = configuration;
                }
                //shell.ModalDialog.ShowDialog();
            });

            DebugCommand = ReactiveCommand.Create();
            DebugCommand.Subscribe(_ =>
            {
                //shell.Debug(model);
            });

            BuildCommand = ReactiveCommand.Create();
            BuildCommand.Subscribe(o => { shell.Build(model); });

            CleanCommand = ReactiveCommand.Create();

            CleanCommand.Subscribe(o => { shell.Clean(model); });

            ManageReferencesCommand = ReactiveCommand.Create();

            ManageReferencesCommand.Subscribe(o => { });

            SetProjectCommand = ReactiveCommand.Create();

            SetProjectCommand.Subscribe(o =>
            {
                model.Solution.StartupProject = model;
                model.Solution.Save();

                shell.InvalidateCodeAnalysis();

                foreach (var project in solutionViewModel.Projects)
                {
                    project.Invalidate();
                }
            });

            OpenInExplorerCommand = ReactiveCommand.Create();
            OpenInExplorerCommand.Subscribe(o => { Process.Start(Model.CurrentDirectory); });

            NewItemCommand = ReactiveCommand.Create();
            NewItemCommand.Subscribe(_ =>
            {
                shell.ModalDialog = new NewItemDialogViewModel(model);
                shell.ModalDialog.ShowDialog();
            });

            RemoveCommand = ReactiveCommand.Create();
            RemoveCommand.Subscribe(async o =>
            {
                await shell.CloseDocumentsForProjectAsync(Model);
                Model.Solution.RemoveProject(Model);
                Model.Solution.Save();
            });
        }
예제 #7
0
 public NewItemVM()
 {
     NewItemCommand = new NewItemCommand(this);
     Item           = new Item();
 }