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);
                }
            }
        }
 public override void Handle(IntentsDataFlowData obj)
 {
     if (obj != null) {
         IEnumerable<ICommand> intentStates = EvaluateIntentStates(obj.Value);
         _commandResult = CombineCommands(intentStates);
     }
 }
Example #3
0
        public EventsViewModel(INavigationController navigationController)
        {
            Title = AppResources.EventsTitle;

            EventActivatedCommand = ControllerUtil.MakeShowCourseEventCommand(navigationController);
            Index = 8;
        }
Example #4
0
	public static ICommand Unwrap(ICommand command) {
		CommandWrapper w = command as CommandWrapper;
		if (w != null)
			return w.wrappedCommand;
		else
			return command;
	}
		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);
		}
Example #6
0
        public void Execute(ICommand command)
        {
            command.Execute();

            undoStack.Push(command);
            redoStack.Clear();
        }
Example #7
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 #8
0
 public ForEachCommand(string name, IExpression expression, ICommand command, bool localvar)
 {
     this.name = name;
     this.expression = expression;
     this.command = command;
     this.localvar = localvar;
 }
Example #9
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);
        }
        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));
        }
        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
        }
Example #12
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;
                }
            }
        }
Example #13
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;
        }
        /// <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));
        }
 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);
 }
Example #16
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 #17
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 #18
0
 public Difference(string value, Page parent)
 {
     SelectedValue = "";
     _value = value;
     _parent = parent;
     _ignoreSelectedCommand = new RelayCommand(param => AddIgnoreSelected(), emnu => SelectedValue != "" );
 }
Example #19
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 #20
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);
                        }
                    });
        }
        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);
        }
 public ButtonCommandBinding(ICommand command, Button item)
 {
     this.command = command;
     this.item = item;
     this.Bind();
     this.command.Refresh();
 }
 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();
 }
Example #24
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));
        }
Example #25
0
        public DM_Dialog(ICommand command)
        {
            InitializeComponent();
            _commands = command;
            

        }
 private void EnsureLongClickOverloaded()
 {
     if (this._longClickOverloaded)
         return;
     this._longClickOverloaded = true;
     this.ItemView.LongClick += (sender, args) => ExecuteCommandOnItem(this.LongClick);
 }
Example #27
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);
     }
 }
Example #28
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;
 }
 public MainViewModel()
 {
     SearchItemCommand = new DelegateCommand(SearchItem);
     UpdateHire1Command = new DelegateCommand(UpdateHire1);
     UpdateHire2Command = new DelegateCommand(UpdateHire2);
    
 }
Example #30
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;
     }
 }