Пример #1
0
        public MainWindowViewModel()
        {
            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                openFileService = Resolve<IOpenFileService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            #region Commands

            //New VM Command
            newVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteNewVMCommand,
                ExecuteDelegate = x => ExecuteNewVMCommand()
            };


            //Open VM Command
            openVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteOpenVMCommand,
                ExecuteDelegate = x => ExecuteOpenVMCommand()
            };
            #endregion


        }
Пример #2
0
 public LoginViewModel()
 {
     RegistCommand = new SimpleCommand<object, object>(Regist);
     OkCommand = new SimpleCommand<object, object>(OnOkExcute);
     Users = new ObservableCollection<User>();
     LoadUserInfos();
 }
Пример #3
0
 public FileListViewModel()
 {
     _refreshCommand = new SimpleCommand
     {
         CanExecuteDelegate = x => true,
         ExecuteDelegate = x => CurrentDirectoryModel.Refresh()
     };
 }
 public FileListViewModel(ICurrentDirectoryViewModelFactory curDirViewModelFactory)
 {
     _curDirViewModelFactory = curDirViewModelFactory;
     _refreshCommand = new SimpleCommand
     {
         CanExecuteDelegate = x => true,
         ExecuteDelegate = x => CurrentDirectoryModel.Refresh()
     };
 }
Пример #5
0
        public CreateMeetViewModel(IViewAwareStatus viewAwareStatus, IMessageBoxService messageBoxService)
        {
            this.viewAwareStatus = viewAwareStatus;
            this.messageBoxService = messageBoxService;

            //Commands
            CreateMeetCommand = new SimpleCommand<Object, Object>(CanExecuteCreateMeetCommand, ExecuteCreateMeetCommand);

            Mediator.Instance.Register(this);
        }
Пример #6
0
        public FileListViewItemViewModel(FileListViewModel rootModel, Model.ExModel model)
            : base(rootModel, model)
        {
            _rootModel = rootModel;

            _expandCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate = x => Expand(_rootModel, (ExModel)x)
            };
        }
Пример #7
0
        public ShellViewModel(IViewAwareStatus viewAwareStatus,
            IMessageBoxService messageBoxService)
        {
            this.viewAwareStatus = viewAwareStatus;
            this.messageBoxService = messageBoxService;

            //Commands
            AddNewMeetCommand = new SimpleCommand<Object, Object>(ExecuteAddNewMeetCommand);

            Mediator.Instance.Register(this);
        }
        public UserRibbonViewViewModel(IMessageBoxService messageBoxService, IViewAwareStatus viewAwareStatus, IViewInjectionService viewInjectionService)
        {
            this.messageBoxService = messageBoxService;
            this.viewAwareStatus = viewAwareStatus;
            this.viewInjectionService = viewInjectionService;

            Mediator.Instance.Register(this);
            //Initialise Commands
            AddNewUserCommand = new SimpleCommand<object, object>(CanExecuteAddNewUserCommand, ExecuteAddNewUserCommand);
            ViewAllUsersCommand = new SimpleCommand<object, object>(CanExecuteViewAllUsersCommand, ExecuteViewAllUsersCommand);
        }
        public ViewModelBase()
        {

            //This is used for popup control only
            CloseActivePopUpCommand = new SimpleCommand<object, object>(x => true, x => ExecuteCloseActivePopupCommand(x));
            CloseWorkSpaceCommand = new SimpleCommand<object, object>(x => true, x => ExecuteCloseWorkSpaceCommand());
  
            Mediator.Instance.RegisterHandler<WorkspaceData>("RemoveWorkspaceItem", OnNotifyDataRecieved);
            collectionView = CollectionViewSource.GetDefaultView(this.Views);


        }
        public MainViewViewModel( IViewAwareStatus viewAwareStatus, IMessageBoxService messageBoxService, IViewInjectionService viewInjectionService)
        {
            //this.regionManager = regionManager;
            this.viewAwareStatus = viewAwareStatus;
            this.messageBoxService = messageBoxService;
            this.viewInjectionService = viewInjectionService;
            this.viewAwareStatus.ViewLoaded += new Action(viewAwareStatus_ViewLoaded);

            //Listen for login event
            Mediator.Instance.Register(this);
            LogoutCommand = new SimpleCommand<object, object>(ExecuteLogoutCommand);
        }
Пример #11
0
        public AddEditOrderViewModel()
        {
            this.DisplayName = "Customer Orders";

            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
            }
            catch
            {
                Logger.Error("Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion



            //Save Order to customer Command
            saveOrderCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteSaveOrderCommand,
                ExecuteDelegate = x => ExecuteSaveOrderCommand()
            };
            //Edit Order
            editOrderCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteEditOrderCommand,
                ExecuteDelegate = x => ExecuteEditOrderCommand()
            };
            //Cancel Edit
            cancelOrderCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteCancelOrderCommand,
                ExecuteDelegate = x => ExecuteCancelOrderCommand()
            };

            try
            {
                //fetch all Products
                Products =
                    DataAccess.DataService.FetchAllProducts().ConvertAll(
                    new Converter<Product, ProductModel>(ProductModel.ProductToProductModel));
                productsCV = CollectionViewSource.GetDefaultView(Products);
                productsCV.CurrentChanged += ProductsCV_CurrentChanged;
                productsCV.MoveCurrentToPosition(-1);

            }
            catch
            {
                messageBoxService.ShowError("There was a problem fetching the products");
            }
        }
Пример #12
0
        public WorkspaceData(string imagePath,string viewLookupKey, object dataValue, string displayText, bool isCloseable)
        {

            Mediator.Instance.Register(this);
            this.ImagePath = imagePath;
            this.ViewLookupKey = viewLookupKey;
            this.DataValue = dataValue;
            this.DisplayText = displayText;
            this.IsCloseable = isCloseable;

            CloseWorkSpaceCommand = new SimpleCommand<object, object>(x => true, x => ExecuteCloseWorkSpaceCommand(x));
        }
        public DirectoryTreeItemViewModel(RootModelBase rootModel, HierarchyViewModel parentModel, Model.DirectoryModel model)
            : base(rootModel, parentModel, model)
        {
            HasSubDirectories = EmbeddedDirectoryModel.EmbeddedDirectoryEntry.HasSubFolder;
            if (HasSubDirectories)
                _subDirs.Add(dummyNode);
            setUpBackgroundWorker();

            _refreshCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate = x => Refresh()
            };
        }
Пример #14
0
        public MainViewModel(IMessageBoxService service)
        {
            this.service = service;
            MiListilla = new List<string>
                             {
                                 "Hello",
                                 "I enjoy a lot",
                                 "doing Drag",
                                 "and",
                                 "Drop!",
                                 "Oh yeah!",
                             };

            ShowMessageCommand = new SimpleCommand<object, object>(o => service.ShowInformation(string.Format("You've dropped a {0} into a {1}",  o.ToString(), DropTarget)));
        }
        public MainWindowViewModel(ISaveFileService saveFileService, IOpenFileService openFileService)
        {
            SaveFileService = saveFileService;
            OpenFileService = openFileService;
            GroupCommandArgs = new GroupCommandArgs
            {
                CreateHostingItem = () => new Group()
            };

            LoadCommand = new SimpleCommand<object, object>(o => Load());
            SaveCommand = new SimpleCommand<object, object>(o => Save());

            this.Document = CreateSampleItems();
            this.Recorder = this.Document.QueryInterface<IRecordable>().Recorder;
            this.Recorder.Clear();
        }
Пример #16
0
        public SimpleRoutedCommand(RoutedUICommand routedCommand, SimpleCommand simpleCommand)
        {
            _routedCommand   = routedCommand;
            _embeddedCommand = simpleCommand;
            ExecuteDelegate  = x =>
            {
                _embeddedCommand.Execute(x);
                this.CommandSucceeded = simpleCommand.CommandSucceeded;
            };

            CanExecuteDelegate = x =>
            {
                return(_embeddedCommand.CanExecute(x));
            };

            init();
        }
Пример #17
0
        public SimpleRoutedCommand(RoutedUICommand routedCommand, SimpleCommand simpleCommand)
        {
            _routedCommand = routedCommand;
            _embeddedCommand = simpleCommand;
            ExecuteDelegate = x =>
            {
                _embeddedCommand.Execute(x);
                this.CommandSucceeded = simpleCommand.CommandSucceeded;
            };

            CanExecuteDelegate = x =>
            {
                return _embeddedCommand.CanExecute(x);
            };

            init();
        }
Пример #18
0
        public PropertiesViewModel()
        {

            #region Commands

            //AddNewPropertyCommand
            addNewPropertyCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteAddNewPropertyCommand,
                ExecuteDelegate = x => ExecuteAddNewPropertyCommand()
            };

            //EditPropertiesCommand
            editPropertiesCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteEditPropertiesCommand,
                ExecuteDelegate = x => ExecuteEditPropertiesCommand()
            };

            //EditReferencedAssembliesCommand
            editReferencedAssembliesCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteEditReferencedAssembliesCommand,
                ExecuteDelegate = x => ExecuteEditReferencedAssembliesCommand()
            };
            #endregion


            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                uiVisualizerService = Resolve<IUIVisualizerService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            PropertyVMs = new ObservableCollection<SinglePropertyViewModel>();
            this.DisplayName = "Add Some Properties";

        }
        public AddNewUserViewViewModel(IViewAwareStatus viewAwareStatus, IMessageBoxService messageBoxService, IUserService userService, IOpenFileService openFileService)
        {
            this.viewAwareStatus = viewAwareStatus;
            this.messageBoxService = messageBoxService;
            this.userService = userService;
            this.openFileService = openFileService;
            NewUser = new User();
            NewUser.PhotoPath.DataValue = GymSoft.CinchMVVM.Common.GymSoftConfigurationManger.GetDefaultUserPicture().ToString();

            //messageBoxService.ShowInformation(Directory.GetCurrentDirectory());

            //Initialise Commands
            AddNewUserCommand = new SimpleCommand<object, object>(CanAddNewUserCommand, ExecuteAddNewUserCommand);
            CancelAddNewUserCommand = new SimpleCommand<object, object>(ExecuteCancelAddNewUserCommand);
            UploadUserImageCommand = new SimpleCommand<object, object>(CanExecuteUploadUserImageCommand,
                                                                       ExecuteUploadUserImageCommand);
            //this._viewAwareStatus.ViewLoaded += new Action(_viewAwareStatus_ViewLoaded);
        }
Пример #20
0
        public SinglePropertyViewModel()
        {
            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            #region Commands

            //RemovePropertyCommand
            removePropertyCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteRemovePropertyCommand,
                ExecuteDelegate = x => ExecuteRemovePropertyCommand()
            };
            #endregion

            #region Create Validation Rules

            this.AddRule(new SimpleRule(propNameChangeArgs.PropertyName, 
                    "Property Name can not be empty",
                      delegate
                      {
                          return String.IsNullOrEmpty(this.PropName);
                      }));
            this.AddRule(new SimpleRule(propertyTypeChangeArgs.PropertyName, 
                    "Property Type can not be empty",
                      delegate
                      {
                          return String.IsNullOrEmpty(this.PropertyType);
                      }));
            #endregion

        }
Пример #21
0
        public TagTestViewModel()
        {
            Tags.Add(new Tag() {TagName="CM-1401",TagSource="Jira" });
            Tags.Add(new Tag() { TagName = "CM-967", TagSource = "Jira" });
            Tags.Add(new Tag() { TagName = "CM-2221", TagSource = "Jira" });
            Tags.Add(new Tag() { TagName = "CM-2323", TagSource = "Jira" });
            Tags.Add(new Tag() { TagName = "CM-1234", TagSource = "Jira" });
            Tags.Add(new Tag() { TagName = "CM-2222", TagSource = "Jira" });
            Tags.Add(new Tag() { TagName = "CM-3333", TagSource = "Jira" });
            Tags.Add(ImportantTag);

            QueryTag = new SimpleCommand<object, object>(
            delegate(object p)
            {
                System.Diagnostics.Debug.WriteLine(p);

            }

            );
            //System.Windows.Interactivity.EventTrigger
        }
Пример #22
0
        public StartPageViewModel()
        {
            #region Create Commands

            //Create Add Cusomer command
            addCustomerCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate = x => ExecuteAddCustomerCommand()
            };

            //Create Search Customers command
            searchCustomersCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate = x => ExecuteSearchCusomersCommand()
            };

            #endregion

            this.DisplayName = "Home";
        }
        public ReferencedAssembliesViewModel()
        {
            #region Commands

            //AddNewPropertyTypeCommand
            addNewAssemblyCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteAddNewAssemblyCommand,
                ExecuteDelegate = x => ExecuteAddNewAssemblyCommand()
            };

            //RemovePropertyTypeCommand
            removeAssemblyCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteRemoveAssemblyCommand,
                ExecuteDelegate = x => ExecuteRemoveAssemblyCommand()
            };
            #endregion

            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                uiVisualizerService = Resolve<IUIVisualizerService>();
                openFileService = Resolve<IOpenFileService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            referencedAssemblies = new ObservableCollection<FileInfo>();
            referencedAssembliesCV = CollectionViewSource.GetDefaultView(referencedAssemblies);
            referencedAssembliesCV.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));

        }
Пример #24
0
        public SearchCustomersViewModel()
        {
            this.DisplayName = "Search Customers";
            BoundType = typeof(MVVM.DataAccess.Customer);

            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            #region Create Commands
            //Create do search Command
            doSearchCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate = x => ExecuteDoSearchCommand()
            };
            //Create delete customer Command
            deleteCustomerCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteDeleteCustomerCommand,
                ExecuteDelegate = x => ExecuteDeleteCustomerCommand()
            };
            //Create edit customer Command
            editCustomerCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteEditCustomerCommand,
                ExecuteDelegate = x => ExecuteEditCustomerCommand()
            };
            #endregion
        }
Пример #25
0
        public PropertyTypesViewModel()
        {
            #region Commands

            //AddNewPropertyTypeCommand
            addNewPropertyTypeCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteAddNewPropertyTypeCommand,
                ExecuteDelegate = x => ExecuteAddNewPropertyTypeCommand()
            };

            //RemovePropertyTypeCommand
            removePropertyTypeCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteRemovePropertyTypeCommand,
                ExecuteDelegate = x => ExecuteRemovePropertyTypeCommand()
            };
            #endregion

            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                uiVisualizerService = Resolve<IUIVisualizerService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            propertyTypes = new ObservableCollection<String>();
            propertyTypesCV = CollectionViewSource.GetDefaultView(propertyTypes);
            propertyTypesCV.SortDescriptions.Add(new SortDescription());

        }
Пример #26
0
 public ViewModelBase()
 {
     //This is used for popup control only
     CloseActivePopUpCommand = new SimpleCommand <object, object>(x => true, x => ExecuteCloseActivePopupCommand(x));
     CloseWorkSpaceCommand   = new SimpleCommand <object, object>(x => true, x => ExecuteCloseWorkSpaceCommand());
 }
Пример #27
0
        public InMemoryViewModel()
        {
            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                saveFileService = Resolve<ISaveFileService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            #region Commands

            //Save VM Command
            saveVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteSaveVMCommand,
                ExecuteDelegate = x => ExecuteSaveVMCommand()
            };

            //Generate VM Command
            generateVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteGenerateVMCommand,
                ExecuteDelegate = x => ExecuteGenerateVMCommand()
            };


            #endregion

            Workspaces = new ObservableCollection<ViewModelBase>();
            Workspaces.CollectionChanged += this.OnWorkspacesChanged;

            #region Create Validation Rules
            this.AddRule(new SimpleRule(viewModelNameChangeArgs.PropertyName,
                         "ViewModelName can't be empty",
                           delegate
                           {
                               return String.IsNullOrEmpty(this.ViewModelName);
                           }));
           
            this.AddRule(new SimpleRule(viewModelNameChangeArgs.PropertyName,
                         "ViewModelName can't contain spaces",
                           delegate
                           {
                               if (String.IsNullOrEmpty(this.ViewModelName))
                               {
                                   return true;
                               }
                               else
                               {
                                   return this.ViewModelName.Contains(" ");
                               }
                           }));

            this.AddRule(new SimpleRule(viewModelNamespaceChangeArgs.PropertyName,
                         "ViewModelNamespace can't be empty",
                           delegate
                           {
                               return String.IsNullOrEmpty(this.ViewModelNamespace);
                           }));
            
            this.AddRule(new SimpleRule(viewModelNamespaceChangeArgs.PropertyName,
                         "ViewModelNamespace can't contain spaces",
                           delegate
                           {
                               if (String.IsNullOrEmpty(this.ViewModelNamespace))
                               {
                                   return true;
                               }
                               else
                               {
                                   return this.ViewModelNamespace.Contains(" ");
                               }
                           }));
            #endregion
        }
Пример #28
0
 public RegistViewModel()
 {
     OkCommand = new SimpleCommand<object, object>(OnOkClicked);
 }
        public CurrentDirectoryViewModel(FileListViewModel rootModel, Model.DirectoryModel model)
            : base(rootModel, model)
        {
            IsLoaded = false;
            _rootModel = rootModel;

            _subEntries = new CollectionViewSource();
            _subEntries.Source = SubEntriesInternal;
            _subEntries.SortDescriptions.Add(new SortDescription("IsDirectory", ListSortDirection.Descending));
            _subEntries.SortDescriptions.Add(new SortDescription("FullName", ListSortDirection.Ascending));

            _refreshCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate = x => Refresh()
            };

            #region FileSystemWatcher
            _watcher = new FileSystemWatcherEx(model.EmbeddedDirectoryEntry);

            var handler = (FileSystemEventHandlerEx)delegate(object sender, FileSystemEventArgsEx args)
            {
                if (args.FullPath.Equals(model.FullName))
                    Refresh();
            };
            var renameHandler = (RenameEventHandlerEx)delegate(object sender, RenameEventArgsEx args)
            {
                if (args.OldFullPath.Equals(model.FullName))
                    Refresh();
            };

            _watcher.OnChanged += handler;
            _watcher.OnCreated += handler;
            _watcher.OnDeleted += handler;
            _watcher.OnRenamed += renameHandler;
            #endregion
        }
Пример #30
0
        public ViewModelBase(IIOCProvider iocProvider)
        {
            if (iocProvider == null)
            {
                throw new InvalidOperationException(
                          String.Format(
                              "ViewModelBase constructor requires a IIOCProvider instance in order to work"));
            }

            this.iocProvider = iocProvider;

            if (!ViewModelBase.isInitialised)
            {
                iocProvider.SetupContainer();
                FetchCoreServiceTypes();
            }

            //Register all decorated methods to the Mediator
            //Register all decorated methods to the Mediator
            Mediator.Instance.Register(this);

            #region Wire up Window/UserControl based Lifetime commands
            activatedCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowActivated()
            };

            deactivatedCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowDeactivated()
            };

            loadedCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowLoaded()
            };

            unloadedCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowUnloaded()
            };

            closeCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowClose()
            };
            #endregion

            #region Wire up Workspace Command

            //This is used for popup control only
            closeWorkSpaceCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => ExecuteCloseWorkSpaceCommand()
            };

            #endregion

            //This is used for popup control only
            closeActivePopUpCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnCloseActivePopUp(x)
            };
        }
Пример #31
0
 public SimpleRoutedCommand(SimpleCommand simpleCommand)
     : this(simpleCommand.UICommand, simpleCommand)
 {
 }
Пример #32
0
        public AddEditCustomerViewModel()
        {
            this.DisplayName = "Add Customer";

            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                uiVisualizerService = Resolve<IUIVisualizerService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            #region Create Commands
            //Create save customer Command
            saveCustomerCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteSaveCustomerCommand,
                ExecuteDelegate = x => ExecuteSaveCustomerCommand()
            };
            //Create edit customer Command
            editCustomerCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteEditCustomerCommand,
                ExecuteDelegate = x => ExecuteEditCustomerCommand()
            };
            //Create cancel customer Command
            cancelCustomerCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteCancelCustomerCommand,
                ExecuteDelegate = x => ExecuteCancelCustomerCommand()
            };
            //Add Order to customer Command
            addOrderCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteAddOrderCommand,
                ExecuteDelegate = x => ExecuteAddOrderCommand()
            };
            //Edit Order to customer Command
            editOrderCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteEditOrderCommand,
                ExecuteDelegate = x => ExecuteEditOrderCommand()
            };
            //Delete Order Command
            deleteOrderCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteDeleteOrderCommand,
                ExecuteDelegate = x => ExecuteDeleteOrderCommand()
            };

            addEditOrderVM = new AddEditOrderViewModel();

            //setup background worker
            SetUpBackgroundWorker();

            #endregion
        }
        public LoginViewViewModel(IViewAwareStatus viewAwareStatus, IAuthenticateService authenticateService,
                                  IMessageBoxService messageBoxService, IBusinessUnitService businessUnitService, IViewInjectionService viewInjectionService)
        {
            //base.IsCloseable = true;
            //Initialise Services
            this.viewAwareStatus = viewAwareStatus;
            this.authenticateService = authenticateService;
            this.messageBoxService = messageBoxService;
            this.businessUnitService = businessUnitService;
            this.viewInjectionService = viewInjectionService;
            //this.regionManager = regionManager;
            //Initialise Properties
            UserName = new DataWrapper<string>(this, userNameArgs);
            Password = new DataWrapper<string>(this, passwordArgs);
            SelectedBusinessUnit = new DataWrapper<Int32>(this, businessUnitsArgs);
            this.viewAwareStatus.ViewLoaded += new Action(viewAwareStatus_ViewLoaded);

            cachedListOfDataWrappers =
                DataWrapperHelper.GetWrapperProperties<LoginViewViewModel>(this);

            //Register Mediator
            Mediator.Instance.Register(this);

            //Initialise Rules
            userName.AddRule(UserNameCannnotBeEmptyRule);
            password.AddRule(PasswordCannotBeEmptyRule);
            selectedBusinessUnit.AddRule(SelectedBusinessUnitCannotBeEmpty);

            //Initialise Commands
            LoginCommand = new SimpleCommand<object, object>(CanExecuteLoginCommand, ExecuteLoginCommand);
            CancelLoginCommand = new SimpleCommand<object, object>(ExecuteCancelLoginCommand);
        }
 public ViewAllUsersViewViewModel(IMessageBoxService messageBoxService, IViewAwareStatus viewAwareStatus,
     IViewInjectionService viewInjectionService, IUserService userService, IOpenFileService openFileService)
 {
     this.messageBoxService = messageBoxService;
     this.viewAwareStatus = viewAwareStatus;
     this.userService = userService;
     this.viewInjectionService = viewInjectionService;
     this.openFileService = openFileService;
     Mediator.Instance.Register(this);
     //Initialise Commands
     UpdateUserCommand = new SimpleCommand<object, object>(CanExecuteUpdateUserCommand, ExecuteUpdateUserCommand);
     UploadUserImageCommand = new SimpleCommand<object, object>(CanExecuteUploadUserImageCommand,
                                                                ExecuteUploadUserImageCommand);
     viewAwareStatus.ViewLoaded += new Action(viewAwareStatus_ViewLoaded);
 }