Example #1
1
        /// <summary>
        /// ��Ʈw�s�W��k
        /// </summary>
        /// <param name="insert"></param>
        public void insert(ICommand insert)
        {
            string myCmd = insert.getCommand();
            try
            {
                cmd = new OdbcCommand(myCmd, GetConn());
                //cmd = new IBM.Data.DB2.DB2Command(myCmd, GetConn());
                cmd.ExecuteNonQuery();
            }
            catch (OdbcException dobcEx)
            {
                if (dobcEx.ErrorCode == -2146232009)
                {
                    return;
                }

                try
                {
                    lock (typeof(OdbcConnection))
                    {
                        //cmd = new IBM.Data.DB2.DB2Command(myCmd, GetConn());
                        cmd = new OdbcCommand(myCmd, GetConn());
                        cmd.ExecuteNonQuery();
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }
Example #2
0
 public AbstractMenuItem(string header, int priority, ImageSource icon = null, ICommand command = null,
                         KeyGesture gesture = null, bool isCheckable = false)
 {
     Priority = priority;
     IsSeparator = false;
     Header = header;
     Key = header;
     Command = command;
     IsCheckable = isCheckable;
     Icon = icon;
     if (gesture != null && command != null)
     {
         Application.Current.MainWindow.InputBindings.Add(new KeyBinding(command, gesture));
         InputGestureText = gesture.DisplayString;
     }
     if (isCheckable)
     {
         IsChecked = false;
     }
     if (Header == "SEP")
     {
         Key = "SEP" + sepCount.ToString();
         Header = "";
         sepCount++;
         IsSeparator = true;
     }
 }
 public MainViewModel()
 {
     SearchItemCommand = new DelegateCommand(SearchItem);
     UpdateHire1Command = new DelegateCommand(UpdateHire1);
     UpdateHire2Command = new DelegateCommand(UpdateHire2);
    
 }
Example #4
0
 /// <summary>
 /// Sets a command into the attached property.
 /// </summary>
 /// <param name="dependencyObject">The dependency object to assign the command.</param>
 /// <param name="value">The command to attach.</param>
 public static void SetCommand(DependencyObject dependencyObject, ICommand value)
 {
     if (dependencyObject != null)
     {
         dependencyObject.SetValue(CommandProperty, value);
     }
 }
 public override void Handle(IntentsDataFlowData obj)
 {
     if (obj != null) {
         IEnumerable<ICommand> intentStates = EvaluateIntentStates(obj.Value);
         _commandResult = CombineCommands(intentStates);
     }
 }
Example #6
0
        public EventsViewModel(INavigationController navigationController)
        {
            Title = AppResources.EventsTitle;

            EventActivatedCommand = ControllerUtil.MakeShowCourseEventCommand(navigationController);
            Index = 8;
        }
Example #7
0
        public DM_Dialog(ICommand command)
        {
            InitializeComponent();
            _commands = command;
            

        }
Example #8
0
		public static ICommand Unwrap(ICommand command) {
			CommandWrapper w = command as CommandWrapper;
			if (w != null)
				return w.wrappedCommand;
			else
				return command;
		}
 public DropdownFieldAttribute(int order, string label) : base(order, label)
 {
     _newItemCommand = new DelegateCommand(NewItem);
     _deleteItemCommand = new DelegateCommand(DeleteItem);
     _setDefaultItemCommand = new DelegateCommand(SetIsDefaultItem);
     UniqueGroupName = Guid.NewGuid().ToString();
 }
		public void Setup()
		{

			_testCommand = A.Fake<ICommand>();
			_publisher = A.Fake<IPublisher>();
			_compositeApp = A.Fake<ICompositeApp>();
			_registry = A.Fake<ICommandRegistry>();
			_formatter = A.Fake<IResponseFormatter>();
			_publicationRecord = A.Fake<ICommandPublicationRecord>();
			_jsonSerializer = new DefaultJsonSerializer();
			_xmlSerializer = new DefaultXmlSerializer();

			A.CallTo(() => _testCommand.Created).Returns(DateTime.MaxValue);
			A.CallTo(() => _testCommand.CreatedBy).Returns(new Guid("ba5f18dc-e287-4d9e-ae71-c6989b10d778"));
			A.CallTo(() => _testCommand.Identifier).Returns(new Guid("ba5f18dc-e287-4d9e-ae71-c6989b10d778"));
			A.CallTo(() => _formatter.Serializers).Returns(new List<ISerializer> { _jsonSerializer, _xmlSerializer });
			A.CallTo(() => _publicationRecord.Dispatched).Returns(true);
			A.CallTo(() => _publicationRecord.Error).Returns(false);
			A.CallTo(() => _publicationRecord.Completed).Returns(true);
			A.CallTo(() => _publicationRecord.Created).Returns(DateTime.MinValue);
			A.CallTo(() => _publicationRecord.MessageLocation).Returns(new Uri("http://localhost/fake/message"));
			A.CallTo(() => _publicationRecord.MessageType).Returns(typeof(IPublicationRecord));
			A.CallTo(() => _publicationRecord.CreatedBy).Returns(Guid.Empty);
			A.CallTo(() => _compositeApp.GetCommandForInputModel(A.Dummy<IInputModel>())).Returns(_testCommand);
			A.CallTo(() => _publisher.PublishMessage(A.Fake<ICommand>())).Returns(_publicationId);
			A.CallTo(() => _registry.GetPublicationRecord(_publicationId)).Returns(_publicationRecord);

			_euclidApi = new ApiModule(_compositeApp, _registry, _publisher);
		}
        private void InitializeViewElements()
        {
            dialogManager = new DialogManager("NUnit Project Editor");
            messageDisplay = new MessageDisplay("NUnit Project Editor");

            browseProjectBaseCommand = new ButtonElement(projectBaseBrowseButton);
            editConfigsCommand = new ButtonElement(editConfigsButton);
            browseConfigBaseCommand = new ButtonElement(configBaseBrowseButton);
            addAssemblyCommand = new ButtonElement(addAssemblyButton);
            removeAssemblyCommand = new ButtonElement(removeAssemblyButton);
            browseAssemblyPathCommand = new ButtonElement(assemblyPathBrowseButton);

            projectPath = new TextElement(projectPathLabel);
            projectBase = new TextElement(projectBaseTextBox);
            processModel = new ComboBoxElement(processModelComboBox);
            domainUsage = new ComboBoxElement(domainUsageComboBox);
            runtime = new ComboBoxElement(runtimeComboBox);
            runtimeVersion = new ComboBoxElement(runtimeVersionComboBox);
            activeConfigName = new TextElement(activeConfigLabel);

            configList = new ComboBoxElement(configComboBox);

            applicationBase = new TextElement(applicationBaseTextBox);
            configurationFile = new TextElement(configFileTextBox);
            binPathType = new RadioButtonGroup("BinPathType", autoBinPathRadioButton, manualBinPathRadioButton, noBinPathRadioButton);
            privateBinPath = new TextElement(privateBinPathTextBox);
            assemblyPath = new TextElement(assemblyPathTextBox);
            assemblyList = new ListBoxElement(assemblyListBox);
        }
Example #12
0
        public void Execute(ICommand command)
        {
            command.Execute();

            undoStack.Push(command);
            redoStack.Clear();
        }
Example #13
0
		void CreateCommand()
		{
			try {
				string link = codon.Properties["link"];
				string command = codon.Properties["command"];
				if (link != null && link.Length > 0) {
					var callback = LinkCommandCreator;
					if (callback == null)
						throw new NotSupportedException("MenuCommand.LinkCommandCreator is not set, cannot create LinkCommands.");
					menuCommand = callback(link);
				} else if (command != null && command.Length > 0) {
					var callback = KnownCommandCreator;
					if (callback == null)
						throw new NotSupportedException("MenuCommand.KnownCommandCreator is not set, cannot create commands.");
					menuCommand = callback(codon.AddIn, command);
				} else {
					menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
				}
				if (menuCommand != null) {
					menuCommand.Owner = caller;
				}
			} catch (Exception e) {
				MessageService.ShowException(e, "Can't create menu command : " + codon.Id);
			}
		}
Example #14
0
        public ArticleViewModel(INewsFeedService newsFeedService, IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            if (newsFeedService == null)
            {
                throw new ArgumentNullException("newsFeedService");
            }

            if (regionManager == null)
            {
                throw new ArgumentNullException("regionManager");
            }

            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }

            this.newsFeedService = newsFeedService;
            this.regionManager = regionManager;

            this.showArticleListCommand = new DelegateCommand(this.ShowArticleList);
            this.showNewsReaderViewCommand = new DelegateCommand(this.ShowNewsReaderView);

            eventAggregator.GetEvent<TickerSymbolSelectedEvent>().Subscribe(OnTickerSymbolSelected, ThreadOption.UIThread);
        }
Example #15
0
		public override void UpdateState(int chainIndex, ICommand[] outputStates)
		{
			int chan = 0; // Current channel being processed.
			byte[] buf = new byte[2];   // The serial data buffer.

			if (serialPortIsValid && _serialPort.IsOpen)
			{
				for (char port = 'A'; port <= 'C'; ++port)
				{
					buf[0] = (byte)port;
					buf[1] = 0;
					for (int bit = 0; (bit < 8 && chan < outputStates.Length && IsRunning); ++bit, ++chan)
					{
						_commandHandler.Reset();
						ICommand command = outputStates[chan];
						if (command != null)
						{
							command.Dispatch(_commandHandler);
						}
						buf[1] |= (byte)(((_commandHandler.Value > _minIntensity) ? 0x01 : 0x00) << bit);
					}
					_serialPort.Write(buf, 0, 2);
				}
			}
		}
Example #16
0
 public ForEachCommand(string name, IExpression expression, ICommand command, bool localvar)
 {
     this.name = name;
     this.expression = expression;
     this.command = command;
     this.localvar = localvar;
 }
Example #17
0
 public ResourceViewModel(Resource resource, ICommand openJsonWindowCommand)
 {
     this.Resource = resource;
     this.References = resource.References.Select(m => new Views.ReferenceListItem(m, Views.ReferenceListItem.Display.NoMod, resource)).ToList();
     this.ReferredBy = resource.ReferredBy.Select(m => new Views.ReferenceListItem(m, Views.ReferenceListItem.Display.SourcedNoMod, resource)).ToList();
     this.OpenJsonWindowCommand = openJsonWindowCommand;
 }
Example #18
0
        public void Execute(ICommand command)
        {
            var commandHandler = _commandHandleProvider.GetInternalCommandHandle(command.GetType());

            var commandContext = new CommandContext(_repository);

            commandHandler(commandContext, command);

            var aggregateRoots = commandContext.AggregateRoots;

            if (aggregateRoots.Count > 1)
                throw new Exception("one command handler can change just only one aggregateRoot.");

            var aggregateRoot = aggregateRoots.First().Value;

            var domainEvents = aggregateRoot.GetUnCommitEvents();

            var eventStream = BuildEventStream(aggregateRoot, command.CommandId);

            _eventStore.AppendAsync(eventStream);

            if (aggregateRoot.Version % 3 == 0)
                _snapshotStorage.Create(new SnapshotRecord(aggregateRoot.AggregateRootId, aggregateRoot.Version,
                    _binarySerializer.Serialize(aggregateRoot)));

            _eventPublisher.PublishAsync(domainEvents);

            aggregateRoot.Clear();

            Console.WriteLine(aggregateRoot.ToString());

            Console.WriteLine("DomainEvents count is {0}", domainEvents.Count);
        }
Example #19
0
        public static Task SendAsync(this ICommandBus commandBus, ICommand command)
        {
            if (commandBus == null) throw new ArgumentNullException(nameof(commandBus));
            if (command == null) throw new ArgumentNullException(nameof(command));

            return commandBus.SendAsync(new Envelope<ICommand>(command));
        }
 private void EnsureLongClickOverloaded()
 {
     if (this._longClickOverloaded)
         return;
     this._longClickOverloaded = true;
     this.ItemView.LongClick += (sender, args) => ExecuteCommandOnItem(this.LongClick);
 }
Example #21
0
        public LoanViewModel(IMessageBus messenger, Loan loan)
        {
            myLoan = loan;
            _OweTo = myLoan.Lender.Name;
            _APR = myLoan.APR;
            _OutstandingBalance = myLoan.OutstandingBalance(DateTime.Now);

            _MakePaymentCommand = new DelegateCommand(MakePaymentExecute, MakePaymentCanExecute);

            myMessenger = messenger;
            myMessenger
                .Listen<Loan>("PaymentMade")
                .ObserveOnDispatcher()
                .Subscribe(
                    l =>
                    {
                        if (l == myLoan)
                        {
                            myMessenger.SendMessage<Person>(loan.Lender, "BalanceChanged");
                            myMessenger.SendMessage<Person>(loan.Borrower, "BalanceChanged");
                            this.PaymentMaker = null;
                            this.OutstandingBalance = myLoan.OutstandingBalance(DateTime.Now);
                        }
                    });
        }
 public ButtonCommandBinding(ICommand command, Button item)
 {
     this.command = command;
     this.item = item;
     this.Bind();
     this.command.Refresh();
 }
Example #23
0
 public Difference(string value, Page parent)
 {
     SelectedValue = "";
     _value = value;
     _parent = parent;
     _ignoreSelectedCommand = new RelayCommand(param => AddIgnoreSelected(), emnu => SelectedValue != "" );
 }
        public VMListadoItinerarios()
        {
            viewDetails_OnClicked = new Command(getDetails);

            #region Lista
            ItineraryList = new ObservableCollection<Itinerary>()
            {
                new Itinerary{Description = "Runzheimer Intl.", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "851 Cornerstone Crossing Waterford, WI 53185, Estados Unidos", ItineraryMiles = 45.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Caesar's Palace", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Juan A. Maza 3754, Rosario, Argentina", ItineraryMiles = 45.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Abel Enterprises", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Alem 2276, Rosario, Argentina", ItineraryMiles = 12.233, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Casino Royale", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Bv. Oroño 6300, Rosario, Santa Fe", ItineraryMiles = 45.4, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Casino Cal.", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Callao 100 bis, Rosario, Santa Fe", ItineraryMiles = 25.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Racket shaker", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Gaboto 552, Rosario, Santa Fe", ItineraryMiles = 25.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Souless corp.", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Dean Funes 740, Rosario, Santa Fe", ItineraryMiles = 25.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today,IdItinerario = contador++ },
                new Itinerary{Description = "Runzheimer Intl.", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "851 Cornerstone Crossing Waterford, WI 53185, Estados Unidos", ItineraryMiles = 45.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Caesar's Palace", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Juan A. Maza 3754, Rosario, Argentina", ItineraryMiles = 45.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Abel Enterprises", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Alem 2276, Rosario, Argentina", ItineraryMiles = 12.233, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Casino Royale", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Bv. Oroño 6300, Rosario, Santa Fe", ItineraryMiles = 45.4, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Runzheimer Intl.", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "851 Cornerstone Crossing Waterford, WI 53185, Estados Unidos", ItineraryMiles = 45.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Caesar's Palace", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Juan A. Maza 3754, Rosario, Argentina", ItineraryMiles = 45.0, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Abel Enterprises", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Alem 2276, Rosario, Argentina", ItineraryMiles = 12.233, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ },
                new Itinerary{Description = "Casino Royale", OriginAdress = "Alvear 1670, Rosario, Santa Fe", FinalAdress = "Bv. Oroño 6300, Rosario, Santa Fe", ItineraryMiles = 45.4, OriginTime=DateTime.Today, FinalTime=DateTime.Today, ItineraryDay = DateTime.Today, IdItinerario = contador++ }


            };
            #endregion
        }
        public async Task Handle(ICommand<CreateSale> command)
        {
            var cmd = command.Payload;

            await repository.CreateOrUpdate(cmd.SaleId,
                                            s => s.Create(cmd.SellerId, cmd.Item, cmd.Price, cmd.Stock));
        }
Example #26
0
        //private static void UpdateCheckedState(StopAstConversion stopCode)
        //{
        //    // this does not work.
        //    foreach (MenuItem item in MainWindow.Instance.GetMainMenuItems())
        //    {
        //        if (!(item.Command is StopMenuCommand))
        //            continue;
        //        var attr = GetAttribute(item.Command);

        //        if (attr.StopCode == stopCode)
        //        {
        //            item.IsCheckable = true;
        //            item.IsChecked = true;
        //        }
        //        else
        //        {
        //            item.IsChecked = false;
        //        }
        //    }
        //}

        private static StopRLMenuCommandAttribute GetAttribute(ICommand command)
        {
            var attr = command.GetType().GetCustomAttributes(typeof(StopRLMenuCommandAttribute), true)
                              .Cast<StopRLMenuCommandAttribute>()
                              .FirstOrDefault();
            return attr;
        }
Example #27
0
        /// <summary>
        /// Adds a command to the collection and signs up for the <see cref="ICommand.CanExecuteChanged"/> event of it.
        /// </summary>
        ///  <remarks>
        /// If this command is set to monitor command activity, and <paramref name="command"/> 
        /// implements the <see cref="IActiveAware"/> interface, this method will subscribe to its
        /// <see cref="IActiveAware.IsActiveChanged"/> event.
        /// </remarks>
        /// <param name="command">The command to register.</param>
        public virtual void RegisterCommand(ICommand command)
        {
            if (command == this)
            {
                throw new ArgumentException(Resources.CannotRegisterCompositeCommandInItself);
            }

            lock (this.registeredCommands)
            {
                if (this.registeredCommands.Contains(command))
                {
                    throw new InvalidOperationException(Resources.CannotRegisterSameCommandTwice);
                }
                this.registeredCommands.Add(command);
            }

            command.CanExecuteChanged += this.onRegisteredCommandCanExecuteChangedHandler;
            this.OnCanExecuteChanged();

            if (this.monitorCommandActivity)
            {
                var activeAwareCommand = command as IActiveAware;
                if (activeAwareCommand != null)
                {
                    activeAwareCommand.IsActiveChanged += this.Command_IsActiveChanged;
                }
            }
        }
 public LogonPageViewModel(IViewModelHost host)
     : base(host)
 {
     // set RegisterCommand to defer to the DoRegistration method...
     this.LogonCommand = new DelegateCommand((args) => DoLogon(args as CommandExecutionContext));
     this.RegisterCommand = new NavigateCommand<IRegisterPageViewModel>(host);
 }
        /// <summary>
        /// Construct the trip view, passing in the persistent trip store. Sets up
        /// a command to handle invoking the Add button.
        /// </summary>
        /// <param name="store"></param>
        public TripListViewModel(TripStore store)
        {
            this.store = store;
            Trips = store.Trips;

            addTripCommand = new RelayCommand(new Action(AddTrip));
        }
Example #30
0
        public QueryResultsViewModel(string caption, IQueryResultsView view, IEventAggregator aggregator, ITimeLineService service, 
            IAsyncManager asyncManager, ContextMenuRoot menu)
        {
            this._aggregator = aggregator;
            _service = service;
            this._asyncManager = asyncManager;
            Caption = caption;
            View = view;

            View.DataContext = this;

            this.Tweets = new ObservableCollection<TweetViewModel>();

            this._aggregator.GetEvent<RefreshEvent>().Subscribe(Refresh//,
                ,ThreadOption.UIThread, true,
                _ => !this.Editing
                );

            GlobalCommands.UpCommand.RegisterCommand(new DelegateCommand<object>(MoveUp));
            GlobalCommands.DownCommand.RegisterCommand(new DelegateCommand<object>(MoveDown));

            _contextMenu = menu;

            _editCommand = new DelegateCommand<object>(EditSelectedTweet,
                                                       o =>
                                                       this.SelectedTweet !=
                                                       null);

            _cancelEditCommand = new DelegateCommand<object>(CancelEdit,
                o => this.SelectedTweet != null && this.SelectedTweet.Editable);
        }
Example #31
0
 /// <summary>
 /// The same unit of work instance can be used across different instances of repositories
 /// (if needed)
 /// </summary>
 /// <param name="unitOfWork"></param>
 /// <param name="command"></param>
 public CommandRepository(IUnitOfWork unitOfWork, ICommand <TEntity> command)
     : base(command)
 {
     ContractUtility.Requires <ArgumentNullException>(unitOfWork.IsNotNull(), "unitOfWork instance cannot be null");
     _unitOfWork = unitOfWork;
 }
Example #32
0
 public UserSettingsViewModel()
 {
     ChangePassword = new RelayCommand(ChangeUserPassword);
 }
 public void SetOrganizationContext(ICommand command)
 {
     this.btnOrganization.DataContext = command;
 }
Example #34
0
 private void KoppelenCommands()
 {
     InsertCommand      = new BaseCommand(ToevoegenBiertje);
     ImageUploadCommand = new BaseCommand(UploadenFoto);
 }
Example #35
0
 public UpdatePhotoPageViewModel()
 {
     SelectedPhoto = new Photo();
     SaveCommand   = new Command(OnSaveCommand);
     DeleteCommand = new Command(OnDeleteCommand);
 }
        public ShellViewModel(INavigationService navigationService)
        {
            this.navigationService = navigationService;

            ShowCustomersCommand = new RelayCommand(ShowCustomers);
        }
Example #37
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public StandardCalculatorViewModel()
        {
            #region Initialization

            currentData         = new CurrentData();
            buttonsState        = new ButtonsState();
            clearData           = new ClearData(currentData, buttonsState);
            numberFormation     = new NumberFormation(currentData, buttonsState, clearData);
            expressionFormation = new ExpressionFormation(currentData, buttonsState, clearData);
            memory = new Memory();

            #endregion

            #region Create commands

            #region Commands for clearing data

            ClearCommand = new RelayCommand(() =>
            {
                clearData.ClearAll();
                UpdateMainProperties();
            });

            ClearEntryCommand = new RelayCommand(() =>
            {
                clearData.ClearEntry();
                UpdateMainProperties();
            });

            BackspaceCommand = new RelayCommand(() =>
            {
                clearData.Backspace();
                UpdateMainProperties();
            });

            #endregion

            #region Commands for basic math operations

            AdditionCommand = new RelayParameterizedCommand((obj) =>
            {
                expressionFormation.SetBasicMathOperation(BasicMathOperations.Addition);
                UpdateMainProperties();
            }, (obj) => NumberStandardization.NumberCheck(currentData.CurrentNumber));

            SubtractionCommand = new RelayParameterizedCommand((obj) =>
            {
                expressionFormation.SetBasicMathOperation(BasicMathOperations.Subtraction);
                UpdateMainProperties();
            }, (obj) => NumberStandardization.NumberCheck(currentData.CurrentNumber));

            MultiplyCommand = new RelayParameterizedCommand((obj) =>
            {
                throw new NotImplementedException();
            });

            DivisionCommand = new RelayParameterizedCommand((obj) => { throw new NotImplementedException(); });

            ModuleDivisionCommand = new RelayParameterizedCommand((obj) => { throw new NotImplementedException(); });

            EqualCommand = new RelayParameterizedCommand((obj) =>
            {
                expressionFormation.SetBasicMathOperation(BasicMathOperations.Equal);
                UpdateMainProperties();
            }, (obj) => NumberStandardization.NumberCheck(currentData.CurrentNumber));

            #endregion

            #region Number pad commands

            DigitZeroCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Zero);
                UpdateMainProperties();
            });

            DigitOneCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.One);
                UpdateMainProperties();
            });

            DigitTwoCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Two);
                UpdateMainProperties();
            });

            DigitThreeCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Three);
                UpdateMainProperties();
            });

            DigitFourCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Four);
                UpdateMainProperties();
            });

            DigitFiveCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Five);
                UpdateMainProperties();
            });

            DigitSixCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Six);
                UpdateMainProperties();
            });

            DigitSevenCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Seven);
                UpdateMainProperties();
            });

            DigitEightCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Eight);
                UpdateMainProperties();
            });

            DigitNineCommand = new RelayCommand(() =>
            {
                numberFormation.AddDigit(Digits.Nine);
                UpdateMainProperties();
            });

            InvertNumberCommand = new RelayCommand(() =>
            {
                numberFormation.InvertNumber();
                UpdateMainProperties();
            });

            CommaCommand = new RelayCommand(() =>
            {
                numberFormation.AddComma();
                UpdateMainProperties();
            });

            #endregion

            #endregion
        }
Example #38
0
 /// <summary>
 /// Should be used when unit of work instance is not required
 /// i.e when explicit transactions management is not required
 /// </summary>
 public CommandRepository(ICommand <TEntity> command)
     : base(command)
 {
 }
Example #39
0
 public LongListViewModel()
 {
     Title           = "Long lists";
     MoreDataCommand = new Command(_onNeedMoreData);
 }
Example #40
0
 public CommandRepository(ICommand <TEntity> command, IExceptionHandler exceptionHandler)
     : base(command)
 {
     ContractUtility.Requires <ArgumentNullException>(exceptionHandler.IsNotNull(), "exceptionHandler instance cannot be null");
     _exceptionHandler = exceptionHandler;
 }
 private static void SetItemTapped(BindableObject bindable, ICommand value)
 {
     bindable.SetValue(CommandProperty, value);
 }
 protected HttpRequestCommand(ICommand command)
 {
     _command = command;
     command.CanExecuteChanged += (sender, args) => CanExecuteChanged.InvokeSafely(sender, args);
 }
Example #43
0
 public Answer()
 {
     AnswerCommand = new DelegateCommand(new Action(OnAnswer));
 }
Example #44
0
 private void Print(string name, ICommand command)
 {
     Print(name, command.ToString());
 }
Example #45
0
 public void CommandExecuted(ICommand command)
 {
 }
Example #46
0
 public MainViewModel(INavigator navigator)
 {
     Navigator = navigator;
     Navigator.UpdateCurrentViewModelCommand.Execute(ViewType.AUTH);
     CloseAppCommand = new CloseAppCommand();
 }
 public RegisterViewModel()
 {
     SignupCommand = new Command(OnSignup);
     CancelCommand = new Command(OnCancel);
 }
 public override ICommand Affect(ICommand command)
 {
     command.Dispatch(_commandHandler);
     return(_commandHandler.Result);
 }
Example #49
0
 public ChromiumWebBrowserWithScreenshotSupport() : base()
 {
     ScreenshotCommand = new RelayCommand(TakeScreenshot);
 }
Example #50
0
 public CommandWrapper(ICommand wrappedCommand)
 {
     this.wrappedCommand = wrappedCommand;
 }
Example #51
0
 public void AddCommand(ICommand command)
 {
     commands.Add(command);
 }
Example #52
0
 public BucketItem()
 {
     CompletedCommand = new CompletedButtonClick();
     Dates            = new ObservableCollection <DateTime>();
 }
Example #53
0
 public static void SetCommand(BindableObject view, ICommand value) => view.SetValue(CommandProperty, value);
Example #54
0
 public StartPageViewModel()
 {
     NewPlayerBtn      = new RelayCommand(GoToCreateUserPage);
     ExistingPlayerBtn = new RelayCommand(GoToExistingUserPage);
 }
 /// <summary>
 /// Set the WindowClosingCommand dependency property value
 /// </summary>
 /// <param name="target">
 /// The <see cref="DependencyProperty"/> identifier.
 /// </param>
 /// <param name="value">
 /// The dependency property value.
 /// </param>
 public static void SetWindowClosingCommand(DependencyObject target, ICommand value)
 {
     target.SetValue(WindowClosingCommandProperty, value);
 }
Example #56
0
        public EditActorPageViewModel(Actor actor)
        {
            ResourceManager manager = new ResourceManager("BetterThanIMDB.Resources.locale", typeof(FilmsPageViewModel).GetTypeInfo().Assembly);

            _actor      = actor;
            Name        = actor.Name;
            DateOfBirth = actor.DateOfBirth;
            Photo       = actor.Photo;

            foreach (var film in actor.Films)
            {
                _tempFilms.Add(film);
            }

            ApplyCommand = new Command(async() =>
            {
                var col1 = _actor.Films.Except(_tempFilms).ToList();
                var col2 = _tempFilms.Except(_actor.Films).ToList();

                for (int i = 0; i < col1.Count(); i++)
                {
                    col1.ElementAt(i).RemoveActor(_actor);
                }
                for (int i = 0; i < col2.Count(); i++)
                {
                    col2.ElementAt(i).AddActor(_actor);
                }

                _actor.Name        = Name;
                _actor.DateOfBirth = DateOfBirth;
                _actor.Photo       = Photo;

                await App.NavigationService.GoBackAsync();
            });
            SelectDateCommand = new Command(async() =>
            {
                DateTime.TryParse(DateOfBirth, out DateTime currentDate);
                var result = await UserDialogs.Instance.DatePromptAsync(new DatePromptConfig()
                {
                    SelectedDate = currentDate
                });
                if (result.Ok)
                {
                    DateOfBirth = result.SelectedDate.ToString("dd.MM.yyyy");
                }
            });
            SelectImageCommand = new Command(async() =>
            {
                await CrossMedia.Current.Initialize();
                var selectedImageFile = await CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions()
                {
                    CompressionQuality = 92,
                    PhotoSize          = Plugin.Media.Abstractions.PhotoSize.Medium
                });

                if (selectedImageFile != null)
                {
                    Photo = selectedImageFile.Path;
                }
            });
            AddFilmCommand = new Command(() =>
            {
                ActionSheetConfig config = new ActionSheetConfig();
                foreach (var film in _allFilms.Except(_tempFilms))
                {
                    config.Add(film.Title, () => _tempFilms.Add(film));
                }
                config.SetCancel();
                config.Title = manager.GetString("addFilm", CustomSettings.Settings.Instance.Culture);
                UserDialogs.Instance.ActionSheet(config);
            });
            RemoveFilmCommand = new Command(() =>
            {
                ActionSheetConfig config = new ActionSheetConfig();
                foreach (var film in _tempFilms)
                {
                    config.Add(film.Title, () => _tempFilms.Remove(film));
                }
                config.SetCancel();
                config.Title = manager.GetString("removeFilm", CustomSettings.Settings.Instance.Culture);
                UserDialogs.Instance.ActionSheet(config);
            });
        }
 public void Dispatch(ICommand command)
 {
     Contract.Requires(command != null);
 }
Example #58
0
 public CommandLogEnricher(ICommand command)
 {
     _command = command;
 }
Example #59
0
        private void RemoveCommand(ICommand oldCommand, ICommand newCommand)
        {
            EventHandler handler = CanExecuteChanged;

            oldCommand.CanExecuteChanged -= handler;
        }
Example #60
0
File: Time.cs Project: crybx/mud
 public IResult PerformCommand(IMobileObject performer, ICommand command)
 {
     return(new Result(true, GlobalReference.GlobalValues.GameDateTime.InGameFormatedDateTime));
 }