Beispiel #1
1
        public MyViewModel()
        {
            //ll = 100;
            _sensors = new ObservableCollection<sensor>();
            _bacnet = new BacNet("10.81.32.211");
            _bacnet.NetworkModelChangedEvent += OnNetworkModelChanged;
            Thread.Sleep(100);

            SetValueCommand = new DelegateCommand(SetValue);
            GetValueCommand = new DelegateCommand(GetValue);

            var tmpList = new List<uint>();
            tmpList.Add(1100);
            tmpList.Add(1200);
            tmpList.Add(1400);
            tmpList.Add(1500);

            //_bacnet.FindSeveral(tmpList);
            //var tmp = _bacnet[1600].Objects["BI1101"].Get();
            _bacnet[1400].Objects["BI1102"].ValueChangedEvent += OnBacnetValueChanged;
            _bacnet[1400].Objects["BV1102"].ValueChangedEvent += OnBacnetValueChanged;
            SchValues = new List<string>();
            object obj = _bacnet[17811].Objects["AO1104"].Get();
            ll = obj.ToString();

            TestDali();
        }
		public QueryViewModel(ItemFilter item)
		{
			InnerItem = item;

			QueryHelpCommand = new DelegateCommand(RaiseQueryHelpInteractionRequest);
			QueryCheckCommand = new DelegateCommand(RaiseQueryCheckInteractionRequest);
		}
 public BasicAuthorizationSetupViewModel(ViewModel parent, string prompt)
   : base(parent)
 {
   Prompt = prompt;
   RegisterCommand(OkCommand = new DelegateCommand<object>(Ok));
   RegisterCommand(CancelCommand = new DelegateCommand<object>(Cancel));
 }
 public TriggerForkedStatementData()
 {
     _addStatementCommand = new DelegateCommand<string>(
           (s) => { AddStatement(); }, //Execute
           (s) => { return true; } //CanExecute
           );
 }
        public TriggerVm(Trigger trigger, IEnumerable<Signal> avalibleSignals)
        {
            IS_SAVED = false;
            _trigger = trigger;
            _avalibleSignals = avalibleSignals;

            //Testing
            var triggerstatedata = new TriggerStateData(_avalibleSignals);
            var statement = new Statement.Equals(new Signal() { Name = "A1" }, 0);
            triggerstatedata.StateNumber = 1;

            //The trigger will always start with one state initially
            _triggerStateDatas = new List<TriggerStateData>();
            _triggerStateDatas.Add(triggerstatedata);

            ObservableTriggerStates = new ListCollectionView(_triggerStateDatas);

            _saveCommand = new DelegateCommand<string>(
                     (s) => { SaveTrigger(); }, //Execute
                     (s) => { return _canSave; } //CanExecute
                     );
            _saveCommand = new DelegateCommand<string>(
                    (s) => { SaveTrigger(); }, //Execute
                    (s) => { return _canSave; } //CanExecute
                    );

            _saveCommand = new DelegateCommand<string>(
                    (s) => { SaveTrigger(); }, //Execute
                    (s) => { return _canSave; } //CanExecute
                    );
        }
		public PickAssetViewModel(IAssetService assetRepository,
			IViewModelsFactory<IInputNameDialogViewModel> inputNameVmFactory)
		{
			_assetRepository = assetRepository;
			_inputNameVmFactory = inputNameVmFactory;

			AddressBarItems = new ObservableCollection<AssetEntitySearchViewModelBase>();
			SelectedFolderItems = new ObservableCollection<AssetEntitySearchViewModelBase>();

			CommonNotifyRequest = new InteractionRequest<Notification>();

			OpenItemCommand = new DelegateCommand<object>(RaiseOpenItemRequest);
			RefreshCommand = new DelegateCommand(LoadItems);
			UploadCommand = new DelegateCommand(RaiseUploadRequest, () => ParentItem.Type == AssetType.Container || ParentItem.Type == AssetType.Folder);
			CreateFolderCommand = new DelegateCommand(RaiseCreateFolderRequest);
			RenameCommand = new DelegateCommand(RaiseRenameRequest);
			DeleteCommand = new DelegateCommand(RaiseDeleteRequest);
			ParentItem = new RootSearchViewModel(null);
			CommonConfirmRequest = new InteractionRequest<Confirmation>();

			InputNameDialogRequest = new InteractionRequest<ConditionalConfirmation>();

			AssetPickMode = true;
			RootItemId = null;
		}
Beispiel #7
0
        public UnitViewModel(AppConfig config, MainViewModel mvm)
        {
            m_config = config;
            m_mvm = mvm;

            SendToSlotCommand = new DelegateCommand<string>(SendToSlot, x => SelectedIdol != null);
            SaveCommand = new DelegateCommand(Save, () => !string.IsNullOrEmpty(UnitName));
            DeleteCommand = new DelegateCommand(Delete, () => Units.Contains(SelectedUnit));
            MoveToSlotCommand = new DelegateCommand<string>(MoveToSlot, CanMoveToSlot);
            ResetSlotCommand = new DelegateCommand<string>(ResetSlot, CanResetSlot);
            HighlightCommand = new DelegateCommand<string>(Highlight, CanHighlight);
            CopyIidCommand = new DelegateCommand(CopyIid, () => SelectedIdol != null);
            SetGuestCenterCommand = new DelegateCommand(SetGuestCenter, () => SelectedIdol != null);
            CopyIidFromSlotCommand = new DelegateCommand<string>(CopyIidFromSlot);
            SetGuestCenterFromSlotCommand = new DelegateCommand<string>(SetGuestCenterFromSlot);

            Idols = new ListCollectionView(m_config.OwnedIdols);
            Filter = new IdolFilter(config, Idols, false);
            Filter.SetConfig(config.UnitIdolFilterConfig);

            Units = m_config.Units;

            TemporalUnit = new Unit();
            SelectedUnit = Units.FirstOrDefault();

            foreach (var option in config.UnitIdolSortOptions)
            {
                Idols.SortDescriptions.Add(option.ToSortDescription());
            }
        }
        public TriggerVm(Trigger trigger, IEnumerable<Signal> avalibleSignals)
        {
            IS_SAVED = false;
            _trigger = trigger;
            _avalibleSignals = avalibleSignals;

            //The trigger will always start with one state initially
            _triggerStateDatas = new List<TriggerStateDataModel>();
            _triggerStateDatas.Add(new TriggerStateDataModel(_avalibleSignals));

            ObservableTriggerStates = new ListCollectionView(_triggerStateDatas);

            _saveCommand = new DelegateCommand<string>(
                     (s) => { SaveTrigger(); }, //Execute
                     (s) => { return true; } //CanExecute
                     );

            _addCommand = new DelegateCommand<string>(
                    (s) => { AddState(); }, //Execute
                    (s) => { return true; } //CanExecute
                    );

            _removeCommand = new DelegateCommand<string>(
                    (s) => { RemoveState(); }, //Execute
                    (s) => { return true; } //CanExecute
                    );
        }
Beispiel #9
0
        public MainPageViewModel(INavigationService navigationService, IEventAggregator eventAggregator)
        {
            _navigationService = navigationService;
            _eventAggregator = eventAggregator;

            NavigateCommand = new DelegateCommand(Navigate);
        }
        public ViewInvitesViewModel(MainViewModel parent, IMobileServiceTable<Invite> invitesTable, Action dismiss)
        {
            _parent = parent;
            _invitesTable = invitesTable;
            Invites = parent.Invites;

            AcceptCommand = new DelegateCommand<Invite>(async invite =>
            {
                invite.Approved = true;
                await _invitesTable.UpdateAsync(invite);
                Invites.Remove(invite);
                _parent.LoadLists();
                _parent.ViewInvitesCommand.IsEnabled = Invites.Count > 0;
                if (Invites.Count == 0 )
                {
                    dismiss();
                }
            });

            RejectCommand = new DelegateCommand<Invite>(async invite =>
            {
                await _invitesTable.UpdateAsync(invite);
                Invites.Remove(invite);
                _parent.ViewInvitesCommand.IsEnabled = Invites.Count > 0;
                if (Invites.Count == 0)
                {
                    dismiss();
                }
            });
        }
Beispiel #11
0
		private void InitCommands()
		{
			StartFtpCommand = new DelegateCommand(StartFtp);
			ProcessFilesCommand = new DelegateCommand(FindAll);
			FindByCaseNumberCommand = new DelegateCommand(FindByCaseNumber);
			ValidateCommand = new DelegateCommand(Validate);
		}
        public ReservationsViewModel(IServiceFactory serviceFactory)
        {
            _ServiceFactory = serviceFactory;

            ExecuteRentalCommand = new DelegateCommand<int>(OnExecuteRentalCommandExecute);
            CancelReservationCommand = new DelegateCommand<int>(OnCancelReservationCommandExecute);
        }
        public MobileTransactionsViewModel(MainViewModel mainViewModel)
        {
            _mainViewModel = mainViewModel;

            FromDateFilter = DateTime.Today.AddDays(-14);
            ThroughDateFilter = DateTime.Today.AddDays(1);

            SalesmanFilter = mainViewModel.Context.Salesmen.ToList();
            SalesmanFilter.Insert(0, new Salesman { Contragent = new Contragent { LastName = "Any" } });
            SelectedSalesmanFilter = SalesmanFilter.FirstOrDefault();

            //ClientsFilter = mainViewModel.Context.Clients.ToList().Select(x => x.Contragent).ToList();
            //ClientsFilter.Insert(0, new Contragent { LastName = "Any" });
            //SelectedClientFilter = ClientsFilter.FirstOrDefault();

            ClientsFilter = mainViewModel.Context.Clients.ToList().Select(x => x.Contragent.LastName).ToList();

            MobileTransactions = new ObservableCollection<MobileTransactionViewModel>(GetMobileTransactions(mainViewModel.Context));
            MobileTransactionsView = CollectionViewSource.GetDefaultView(MobileTransactions);
            MobileTransactionsView.Filter = Filter;

            AddCommand = new DelegateCommand(Add);
            CloseAddDialogCommand = new DelegateCommand(() => AddDialogViewModel = null);

            DeleteCommand = new DelegateCommand(Delete, () => SelectedTransaction != null);

            FilterCommand = new DelegateCommand(MobileTransactionsView.Refresh);
        }
 public MainWindowViewModel()
 {
     OKButtonCommand = new DelegateCommand(OKButton);
     EmployeeCollection = new ObservableCollection<Employee>();
     PositionsCollection = Enum.GetValues(typeof(Positions)).Cast<Positions>();
     SelectedBirthDate = new DateTime(1970, 1, 1);
 }
 public PageStartMenuViewModel(IRegionManager regionManager, ITaskDialogService taskDialog)
 {
     _regionManager = regionManager;
     _taskDialog = taskDialog;
     NavigateCommand = new DelegateCommand<Uri>(Navigate);
     ExitCommand = new DelegateCommand<Window>(ExitGame);
 }
		private void Init(Model model) {
			OnCompleted += () => {
				disposables.Dispose();
			};
			CancelCommand = new DelegateCommand(
				() => {
					Success(new Result.Cancel());
				},
				() => true
			);
			UploadCommand = new DelegateCommand(
				() => {
					model.certificate.certificateID = certificateNameValue.Text;
					Success(new Result.Upload());
				},
				() => true
			);

			InitializeComponent();

			certificateDetails.Text = CertificateToString(model.certificate);
			certificateNameValue.Text = CertificateNum(model.certificate);

			certificateNameCaption.CreateBinding(TextBlock.TextProperty, Strings, s => s.enterName);
			btnCancel.CreateBinding(Button.ContentProperty, ButtonsLocales, s => s.cancel);
			btnUpload.CreateBinding(Button.ContentProperty, Strings, s => s.uploadCertificate);
			captionDetails.CreateBinding(TextBlock.TextProperty, Strings, s => s.details);
		}
        public TreeCatalogViewModel(
            IViewModelsFactory<ICatalogViewModel> vmFactory,
            catalogModel.Catalog item,
            IRepositoryFactory<ICatalogRepository> repositoryFactory,
            IAuthenticationContext authContext,
            INavigationManager navigationManager,
            IViewModelsFactory<ICatalogDeleteViewModel> catalogDeleteVmFactory,
            IViewModelsFactory<ITreeCategoryViewModel> treeCategoryVmFactory,
            IDataManagementService exportService)
            : base(repositoryFactory, authContext)
        {
            InnerItem = item;
            EmbeddedHierarchyEntry = this;

            _catalogDeleteVmFactory = catalogDeleteVmFactory;
            _treeCategoryVmFactory = treeCategoryVmFactory;
            _exportService = exportService;

            OpenItemCommand = new DelegateCommand(() =>
            {
                if (NavigationData == null)
                {
                    var editVM = vmFactory.GetViewModelInstance(new KeyValuePair<string, object>("item", InnerItem)
                        , new KeyValuePair<string, object>("parentTreeVM", this));
                    NavigationData = ((IClosable)editVM).NavigationData;
                }
                navigationManager.Navigate(NavigationData);
            });

            ExportItemCommand = new DelegateCommand(() => RaiseExportItemCommand());
        }
 public MainPageViewModel(INavigationService navigationService, IPageDialogService dialogService)
 {
     CommandLogarFacebook = new DelegateCommand(LogarFacebook);
     CommandLogar = new DelegateCommand(Autenticar);
     _navigationService = navigationService;
     _dialogservice = dialogService;
 }
		public MainFulfillmentViewModel(
			IInventoryHomeViewModel inventoryVm, 
			IPicklistHomeViewModel picklistVm, 
			IRmaHomeViewModel rmaVm, 
			IViewModelsFactory<ICompleteShipmentViewModel> completeShipmentVmFactory,
			IRepositoryFactory<IOrderRepository> orderRepositoryFactory,
			IOrderService orderService,
			IAuthenticationContext authContext)
        {
            ViewTitle = new ViewTitleBase { Title = "Fulfillment", SubTitle = "FULFILLMENT SERVICE" };
			_inventoryHomeVm = inventoryVm;
			_inventoryHomeVm.ParentViewModel = this;
			
			_picklistHomeVm = picklistVm;
			_picklistHomeVm.ParentViewModel = this;

			_rmaHomeVm = rmaVm;
			_rmaHomeVm.ParentViewModel = this;

			_completeShipmentVmFactory = completeShipmentVmFactory;
			_orderRepositoryFactory = orderRepositoryFactory;
			_authContext = authContext;

			_orderService = orderService;

			PopulateTabItems();
			CompleteShipmentCommand = new DelegateCommand(RaiseCompleteShipment);
			CommonConfirmRequest = new InteractionRequest<Confirmation>();
			CommonNotifyRequest = new InteractionRequest<Notification>();
        }
Beispiel #20
0
        public MainWindowViewModel()
        {
            startCommand = new DelegateCommand(StartService, CanStartService);
            stopCommand = new DelegateCommand(StopService, CanStopService);
            restartCommand = new DelegateCommand(RestartService, CanStopService);
            saveCommand = new DelegateCommand(SaveAndExit, CanFindServiceConfiguration);
            applyCommand = new DelegateCommand(SaveConfiguration, CanFindServiceConfiguration);
            cancelCommand = new DelegateCommand(OnCloseRequested);

            statusUpdateWorker.DoWork += UpdateServiceStatus;
            statusUpdateWorker.RunWorkerCompleted += DisplayNewStatus;

            // TODO: Dynamically determine service name
            service = new ServiceController("EmanateService");
            try
            {
                Status = service.DisplayName + " service is installed";
                serviceIsInstalled = true;
            }
            catch (Exception)
            {
                Status = "Service is not installed";
                serviceIsInstalled = false;
            }

            pluginConfigurationStorer = new PluginConfigurationStorer();
            ConfigurationInfos = new ObservableCollection<ConfigurationInfo>();
        }
        public TimeSlotsDialogViewModel()
        {
            DoubleTappedCommand = new DelegateCommand<DoubleTappedRoutedEventArgs>(DoubleTapped);
            OkCommand = new DelegateCommand(OnOk);

            GetEvent<InitDialogEvent>().Subscribe(OnInitialize);
        }
        public FileController(CompositionContainer container, IMessageService messageService, IFileDialogService fileDialogService,
            IShellService shellService, FileService fileService)
        {
            this.container = container;
            this.messageService = messageService;
            this.fileDialogService = fileDialogService;
            this.shellService = shellService;
            this.fileService = fileService;
            this.documentTypes = new List<IDocumentType>();

            this.newDocumentCommand = new DelegateCommand(NewDocumentCommand, CanNewDocumentCommand);
            this.closeDocumentCommand = new DelegateCommand(CloseDocumentCommand, CanCloseDocumentCommand);
            this.saveDocumentCommand = new DelegateCommand(SaveDocumentCommand, CanSaveDocumentCommand);
            this.saveAllDocumentCommand = new DelegateCommand(SaveAllDocumentCommand, CanSaveAllDocumentCommand);
            this.newSolutionCommand = new DelegateCommand(NewSolutionCommand);
            this.openSolutionCommand = new DelegateCommand(OpenSolutionCommand);
            this.closeSolutionCommand = new DelegateCommand(CloseSolutionCommand, CanCloseSolutionCommand);
            this.showSolutionCommand = new DelegateCommand(ShowSolutionCommand, CanShowSolutionCommand);

            this.fileService.NewDocumentCommand = this.newDocumentCommand;
            this.fileService.CloseDocumentCommand = this.closeDocumentCommand;
            this.fileService.SaveDocumentCommand = this.saveDocumentCommand;
            this.fileService.SaveAllDocumentCommand = this.saveAllDocumentCommand;
            this.fileService.NewSolutionCommand = this.newSolutionCommand;
            this.fileService.OpenSolutionCommand = this.openSolutionCommand;
            this.fileService.CloseSolutionCommand = this.closeSolutionCommand;
            this.fileService.ShowSolutionCommand = this.showSolutionCommand;

            this.recentSolutionList = Settings.Default.RecentSolutionList;
            if (this.recentSolutionList == null) { this.recentSolutionList = new RecentFileList(); }
            this.fileService.RecentSolutionList = recentSolutionList;

            AddWeakEventListener(fileService, FileServicePropertyChanged);
        }
Beispiel #23
0
        public CleanserViewModel()
        {
            ShowOnlyNewResults = true;

            _repo = new SoldOutRepository();

            _deleteSearchResultsCommand = new DelegateCommand<IList>(
                DeleteSelectedSearchResults
                );

            _markAsCleansedCommand = new DelegateCommand<IList>(
                MarkSelectedSearchAsCleansed
                );

            _windowClosingCommand = new DelegateCommand(
                () =>
                {
                    // Clean up the repo
                    if (_repo != null)
                    {
                        _repo.Dispose();
                        _repo = null;
                    }
                }
                );

            Searches = GetSearches();

            SelectedSearchOverview = _searches.First();
        }
Beispiel #24
0
 public OrderViewModel(Order model)
 {
     _model = model;
     ResetSelectedQuantity();
     ItemSelectedCommand = new DelegateCommand<OrderViewModel>(OnItemSelected);
     UpdateItemColor();
 }
 public GettingStartedViewModel(IEventAggregator eventAggregator, INavigate navigator )
 {
     this.eventAggregator = eventAggregator;
     this.navigator = navigator;
     
     ReturnToLoginScreenCommand = new DelegateCommand<object>(ReturnToLoginScreen, CanReturnToLoginScreen);
 }
        public MenuItemSelectorViewModel(IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, IMenuService menuService,
            ISettingService settingService, ICacheService cacheService)
        {
            _applicationState = applicationState;
            _applicationStateSetter = applicationStateSetter;
            _menuService = menuService;
            _settingService = settingService;
            _cacheService = cacheService;

            CategoryCommand = new DelegateCommand<ScreenMenuCategory>(OnCategoryCommandExecute);
            MenuItemCommand = new DelegateCommand<ScreenMenuItem>(OnMenuItemCommandExecute);
            TypeValueCommand = new DelegateCommand<string>(OnTypeValueExecute);
            FindLocationCommand = new DelegateCommand<string>(OnFindLocationExecute, CanFindLocation);
            FindMenuItemCommand = new DelegateCommand<string>(OnFindMenuItemCommand);
            FindTicketCommand = new DelegateCommand<string>(OnFindTicketExecute, CanFindTicket);
            IncPageNumberCommand = new CaptionCommand<string>(Localization.Properties.Resources.NextPage + " >>", OnIncPageNumber, CanIncPageNumber);
            DecPageNumberCommand = new CaptionCommand<string>("<< " + Localization.Properties.Resources.PreviousPage, OnDecPageNumber, CanDecPageNumber);
            SubCategoryCommand = new CaptionCommand<ScreenSubCategoryButton>(".", OnSubCategoryCommand);

            EventServiceFactory.EventService.GetEvent<GenericEvent<Department>>().Subscribe(OnDepartmentChanged);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnNumeratorReset);
            NumeratorValue = "";

            SubCategories = new ObservableCollection<ScreenSubCategoryButton>();
        }
  public EntityListPageViewModel(IEntityRepository entityRepository, INavigationService navService, IEventAggregator eventAggregator) {
      _entityRepository = entityRepository;
      _navService = navService;
      _eventAggregator = eventAggregator;
      NavCommand = new DelegateCommand<Entity>(OnNavCommand);
      EntityDetailNavCommand = new DelegateCommand(() => _navService.Navigate("EntityDetail", 0));
 }
 public TicketButtonViewModel(OpenTicketData openTicketData, Entity baseEntity)
 {
     _openTicketData = openTicketData;
     _baseEntityId = baseEntity != null ? baseEntity.Id : 0;
     OpenTicketCommand = new DelegateCommand<string>(OnOpenTicketCommand);
     SelectTicketCommand = new DelegateCommand<string>(OnSelectTicket);
 }
Beispiel #29
0
 public MoviesPageViewModel(INavigationService navigationService)
 {
     this._navigationService = navigationService;
     this.IsMainGrid = true;
     MoviesItemsCommand = new DelegateCommand<ItemClickEventArgs>(MoviesClickedMethod);
     MovieTrailerTappedCommand = new DelegateCommand(MovieTrailerTappedMethod);
 }
        public MainWindowViewModel(MainWindow _window)
        {
            window = _window;
            RefreshService = new DelegateCommand(Refresh);

            window.FileTreeView.SelectItem = new Action<object>(FileTreeSelected);
        }