예제 #1
0
        /// <inheritdoc />
        /// <summary>
        ///     Initializes this instance.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            _shellProxy = new ShellProxy(this);
            _shellProxy.AdviseDebuggingEvents(this);
            _shellProxy.AdviseSelectionEvents(this);
            _shellProxy.SolutionProxy.AdviseSolutionEvents(this);

            // Shell
            RestartNormalCommand.Initialize(this);
            RestartElevatedCommand.Initialize(this);

            // Environment
            PathVariablesCommand.Initialize(this);

            // Project
            OpenOutputFolderCommand.Initialize(this);
            ShowOutputFileInExplorerCommand.Initialize(this);
            ReloadCommand.Initialize(this);

            // Project Item
            ShowInExplorerCommand.Initialize(this);

            // Refactoring
            MoveToSettingsCommand.Initialize(this);

            // Tools
            ReplaceGuidPlaceholdersCommand.Initialize(this);

            // Package
            ShowOptionPageCommand.Initialize(this);
        }
 private void Save(ReservationDto reservation)
 {
     try
     {
         if (RowVersion != null)
         {
             AutoReservationService.UpdateReservation(reservation);
         }
         else
         {
             AutoReservationService.AddReservation(reservation);
         }
         InvokeOnRequestClose();
     }
     catch (FaultException <DataManipulationFault> )
     {
         InvokeOnSaveError();
         if (CanReload)
         {
             ReloadCommand.Execute(null);
         }
     }
     catch (FaultException <InvalidDateRangeFault> )
     {
         OnSaveErrorDateRange?.Invoke(this, null);
     }
     catch (FaultException <AutoUnavailableFault> )
     {
         OnSaveErrorAutoNotAvailable?.Invoke(this, null);
     }
 }
예제 #3
0
 private async void Timer_Tick(object sender, object e)
 {
     if (ReloadCommand.CanExecute(null))
     {
         await ReloadCommand.Execute(null);
     }
 }
예제 #4
0
    void setCharacter()
    {
        abilities = new Ability[numAbilities];
        for (int i = 0; i < numAbilities; i++)
        {
            abilities[i] = data.abilities[i].GetComponent <Ability>();
            abilities[i].InitAbility(this);
            abilities[i].EAwake();
        }
        reloadingTime    = data.reloadingTime;
        reloading        = false;
        actualBullets    = data.totalBullets;
        totalBullets     = data.totalBullets;
        shootingCooldown = data.shootingCooldown;
        shooting         = false;
        shootingTimer    = 0.0f;

        shootCommand  = gameObject.AddComponent <ShootCommand>();
        reloadCommand = gameObject.AddComponent <ReloadCommand>();

        shootCommand.SetShoot(Shoot());
        InputManager.SetInputs("shoot", shootCommand);
        reloadCommand.SetReload(Reload());
        InputManager.SetInputs("reload", reloadCommand);

        InputManager.SetInputs("useAbility_1", abilities[0]);
        InputManager.SetInputs("useAbility_2", abilities[1]);
        InputManager.SetInputs("useAbility_3", abilities[2]);
    }
예제 #5
0
 public KundeViewModel(int id = -1)
 {
     if (id != -1)
     {
         this.Id = id;
         ReloadCommand.Execute(null);
     }
 }
예제 #6
0
        public void SetUp()
        {
            eventAggregator   = MockRepository.GenerateStub <IEventAggregator>();
            optionsController = MockRepository.GenerateStub <IOptionsController>();
            commandFactory    = MockRepository.GenerateStub <ICommandFactory>();
            StubCommands();

            command = new ReloadCommand(commandFactory, eventAggregator, optionsController);
        }
예제 #7
0
 // Main View Model Function
 public RequestsViewModel(IAPerson dbs, IToast toast)
 {
     this.dbs = dbs;
     ReloadCommand.Execute(null);
     SelectPer = new MvxCommand <Perso>(selectedPer =>
     {
         MyGlobals.perr = null;
         MyGlobals.perr = selectedPer;
         ShowViewModel <AnswerViewModel>();
     });
 }
        public ReservationViewModel(int reservationsNr = -1)
        {
            Kunden = AutoReservationService.GetKunden();
            Autos  = AutoReservationService.GetAutos();

            if (reservationsNr != -1)
            {
                this.ReservationsNr = reservationsNr;
                ReloadCommand.Execute(null);
            }
        }
예제 #9
0
 private void ItemsView_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(IEditableCollectionView.IsEditingItem) ||
         e.PropertyName == nameof(IEditableCollectionView.IsAddingNew))
     {
         OnPropertyChanged(nameof(IsEditingItem));
         CommitCommand.RaiseCanExecuteChanged();
         CancelCommand.RaiseCanExecuteChanged();
         ReloadCommand.RaiseCanExecuteChanged();
         ToggleEditCommand.RaiseCanExecuteChanged();
     }
 }
예제 #10
0
 protected override void RaiseCanExecuteCommands()
 {
     OpenCommand.RaiseCanExecuteChanged();
     CloseCommand.RaiseCanExecuteChanged();
     //NextPageCommand.RaiseCanExecuteChanged();
     //PreviousPageCommand.RaiseCanExecuteChanged();
     //FirstPageCommand.RaiseCanExecuteChanged();
     //LastPageCommand.RaiseCanExecuteChanged();
     SaveCommand.RaiseCanExecuteChanged();
     NewCommand.RaiseCanExecuteChanged();
     DeleteCommand.RaiseCanExecuteChanged();
     ReloadCommand.RaiseCanExecuteChanged();
 }
예제 #11
0
    // Start is called before the first frame update
    void Start()
    {
        defaultCommands = new ICommand[4];

        defaultCommands[0] = new UseKnifeCommand();
        defaultCommands[1] = new ReloadCommand();
        defaultCommands[2] = new LootCommand();
        defaultCommands[3] = new InteractCommand();

        qCommand = defaultCommands[0]; // use knife
        rCommand = defaultCommands[1]; // reload
        xCommand = defaultCommands[2]; // loot
        kCommand = defaultCommands[3]; // interact
    }
예제 #12
0
        void PlayerViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "IsLoading":
                ReloadCommand.NotifyCanExecuteChanged();
                NotifyPropertyChanged("StatusBrush");
                UploadImageCommand.NotifyCanExecuteChanged();
                break;

            case "Error":
                NotifyPropertyChanged("StatusBrush");
                ReloadCommand.NotifyCanExecuteChanged();
                break;

            case "PlayerName":
                NotifyPropertyChanged("Title");
                NotifyPropertyChanged("CleanName");
                break;

            case "IsScreenUploaded":
                UploadImageCommand.NotifyCanExecuteChanged();
                AddReportCommand.NotifyCanExecuteChanged();
                break;

            case "DrawUserInfo":
                NotifyPropertyChanged("Screenshot");
                break;

            case "ScreenshotDate":
                infoScreenshot = DrawInfo(screenshot);
                NotifyPropertyChanged("Screenshot");
                break;

            case "Screenshot":
                SaveImageCommand.NotifyCanExecuteChanged();
                UploadImageCommand.NotifyCanExecuteChanged();
                if (screenshot == null)
                {
                    infoScreenshot = null;
                    GC.Collect();
                }
                break;

            case "ScreenshotTaken":
                NotifyPropertyChanged("StatusBrush");
                break;
            }
        }
예제 #13
0
 public MainWindowViewModel()
 {
     TitlebarButtonCommand.Subscribe(x => Messenger.I.GetEvent <PubSubEvent <string> >().Publish(x));
     PickWorldCommand.Subscribe(() =>
     {
         var dialog = new CommonOpenFileDialog("ワールドフォルダを選択")
         {
             IsFolderPicker = true
         };
         if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
         {
             World.Load(dialog.FileName);
         }
     });
     ReloadCommand.Subscribe(() => World.Reload());
     ErrorDialogCloseCommand.Subscribe(() => World.IsError.Value = false);
 }
예제 #14
0
        public AnsViewModel(IDialogServiceP dialog, IToast toast, IAnsDB ansDB)
        {
            answerDB = ansDB;
            ReloadCommand.Execute(null);
            this.dialog = dialog;

            SelectMessage = new MvxCommand <Answ>(async selectedItem =>
            {
                string mes           = "from " + selectedItem.AnsFrom + "\n" + "Calendar: " + selectedItem.AnsCal + "\n" + "Location: " + selectedItem.AnsLoc + "\nOther Info:" + selectedItem.AnsExtra;
                List <string> Answer = await dialog.Show(mes, "Status Response", "Ok", "Delete");

                if (Answer[0] == "false")
                {
                    Message.Remove(selectedItem);
                    DeleteAns(selectedItem.Id);
                    toast.Show("Status Response Deleted");
                }
            });
        }
예제 #15
0
 protected override void ExecuteSaveCommand()
 {
     try {
         if (RowVersion != null)
         {
             AutoReservationService.UpdateKunde(this.kundeDto);
         }
         else
         {
             AutoReservationService.AddKunde(this.kundeDto);
         }
         InvokeOnRequestClose();
     }
     catch (FaultException <DataManipulationFault> )
     {
         InvokeOnSaveError();
         if (CanReload)
         {
             ReloadCommand.Execute(null);
         }
     }
 }
예제 #16
0
        /// <summary>
        /// Вызывается при построении шаблона элемента управления.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            UpdateVisualState();

            reloadButton = GetTemplateChild(ReloadButtonName) as Button;
            if (reloadButton == null)
            {
                return;
            }

            reloadButton.Click += (s, e) =>
            {
                if (ReloadButtonClick != null)
                {
                    ReloadButtonClick(this, e);
                }

                if (ReloadCommand != null && ReloadCommand.CanExecute(ReloadCommandParameter))
                {
                    ReloadCommand.Execute(ReloadCommandParameter);
                }
            };
        }
예제 #17
0
        public async Task <ViewCommand> ProcessRelationActionAsync(UsageType usageType, string collectionAlias, IEntity relatedEntity, string id, EditContext editContext, string actionId, object?customData)
        {
            var collection = _collectionProvider.GetCollection(collectionAlias);

            var button = collection.FindButton(actionId);

            if (button == null)
            {
                throw new Exception($"Cannot determine which button triggered action for collection {collectionAlias}");
            }

            await EnsureAuthorizedUserAsync(editContext, button);

            EnsureValidEditContext(editContext, button);

            var relationContainer = editContext.GenerateRelationContainer();

            // since the id is known, get the entity variant from the entity
            var entityVariant = collection.GetEntityVariant(editContext.Entity);

            ViewCommand viewCommand;

            var context = new ButtonContext(null, customData);

            switch (await button.ButtonClickBeforeRepositoryActionAsync(editContext, context))
            {
            case CrudType.View:
                viewCommand = new NavigateCommand {
                    Uri = UriHelper.Node(Constants.View, collectionAlias, entityVariant, null, id)
                };
                break;

            case CrudType.Edit:
                viewCommand = new NavigateCommand {
                    Uri = UriHelper.Node(Constants.Edit, collectionAlias, entityVariant, null, id)
                };
                break;

            case CrudType.Update:
                await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalUpdateAsync(id, null, editContext.Entity, relationContainer));

                viewCommand = new ReloadCommand(id);
                break;

            case CrudType.Insert:
                var insertedEntity = await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalInsertAsync(null, editContext.Entity, relationContainer));

                if (insertedEntity == null)
                {
                    throw new Exception("Inserting the new entity failed.");
                }
                editContext.SwapEntity(insertedEntity);
                await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalAddAsync(relatedEntity, editContext.Entity.Id));

                viewCommand = new UpdateParameterCommand
                {
                    Action          = Constants.New,
                    CollectionAlias = collectionAlias,
                    VariantAlias    = entityVariant.Alias,
                    ParentId        = null,
                    Id = editContext.Entity.Id
                };
                break;

            case CrudType.Delete:

                await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalDeleteAsync(id, null));

                viewCommand = new ReloadCommand();
                break;

            case CrudType.Pick:

                await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalAddAsync(relatedEntity, id));

                viewCommand = new ReloadCommand();
                break;

            case CrudType.Remove:

                await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalRemoveAsync(relatedEntity, id));

                viewCommand = new ReloadCommand();
                break;

            case CrudType.None:
                viewCommand = new NoOperationCommand();
                break;

            case CrudType.Refresh:
                viewCommand = new ReloadCommand();
                break;

            default:
                throw new InvalidOperationException();
            }

            await button.ButtonClickAfterRepositoryActionAsync(editContext, context);

            return(viewCommand);
        }
예제 #18
0
        public async Task <ViewCommand> ProcessRelationActionAsync(UsageType usageType, string collectionAlias, IEntity relatedEntity, IEnumerable <EditContext> editContexts, string actionId, object?customData)
        {
            var collection = _collectionProvider.GetCollection(collectionAlias);

            var button = collection.FindButton(actionId);

            if (button == null)
            {
                throw new Exception($"Cannot determine which button triggered action for collection {collectionAlias}");
            }

            var rootEditContext = await GetRootEditContextAsync(usageType, collectionAlias, null);

            var newEntity = await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalNewAsync(null, collection.EntityVariant.Type));

            await EnsureAuthorizedUserAsync(rootEditContext, button);

            ViewCommand viewCommand;

            var context = new ButtonContext(null, customData);

            switch (await button.ButtonClickBeforeRepositoryActionAsync(rootEditContext, context))
            {
            case CrudType.Create:
                if (button.EntityVariant == null)
                {
                    throw new InvalidOperationException();
                }

                if (usageType.HasFlag(UsageType.List))
                {
                    viewCommand = new NavigateCommand {
                        Uri = UriHelper.Node(Constants.New, collectionAlias, button.EntityVariant, null, null)
                    };
                }
                else
                {
                    viewCommand = new UpdateParameterCommand
                    {
                        Action          = Constants.New,
                        CollectionAlias = collectionAlias,
                        VariantAlias    = button.EntityVariant.Alias,
                        ParentId        = null,
                        Id = null
                    };
                }
                break;

            case CrudType.Update:
                var contextsToProcess = editContexts.Where(x => x.IsModified()).Where(x => button.RequiresValidForm(x) ? x.IsValid() : true);
                var affectedEntities  = new List <IEntity>();
                foreach (var editContext in contextsToProcess)
                {
                    try
                    {
                        var updatedEntity = editContext.Entity;
                        await EnsureAuthorizedUserAsync(editContext, button);

                        EnsureValidEditContext(editContext, button);
                        var relationContainer = editContext.GenerateRelationContainer();
                        await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalUpdateAsync(updatedEntity.Id, null, updatedEntity, relationContainer));

                        affectedEntities.Add(updatedEntity);
                    }
                    catch (Exception)
                    {
                        // do not care about exceptions here
                    }
                }
                viewCommand = new ReloadCommand(affectedEntities.Select(x => x.Id));
                break;

            case CrudType.Add:
                viewCommand = new UpdateParameterCommand
                {
                    Action          = Constants.Add,
                    CollectionAlias = collectionAlias,
                    VariantAlias    = null,
                    ParentId        = null,
                    Id = null
                };
                break;

            case CrudType.None:
                viewCommand = new NoOperationCommand();
                break;

            case CrudType.Refresh:
                viewCommand = new ReloadCommand();
                break;

            case CrudType.Return:
                viewCommand = new ReturnCommand();
                break;

            default:
                throw new InvalidOperationException();
            }

            await button.ButtonClickAfterRepositoryActionAsync(rootEditContext, context);

            return(viewCommand);
        }
예제 #19
0
        public async Task <ViewCommand> ProcessEntityActionAsync(UsageType usageType, string collectionAlias, string?parentId, string?id, EditContext editContext, string actionId, object?customData)
        {
            var collection = _collectionProvider.GetCollection(collectionAlias);

            var entityVariant = collection.GetEntityVariant(editContext.Entity);

            var button = collection.FindButton(actionId);

            if (button == null)
            {
                throw new Exception($"Cannot determine which button triggered action for collection {collectionAlias}");
            }

            await EnsureAuthorizedUserAsync(editContext, button);

            EnsureValidEditContext(editContext, button);

            var relationContainer = editContext.GenerateRelationContainer();

            ViewCommand viewCommand;

            var context = new ButtonContext(parentId, customData);

            switch (await button.ButtonClickBeforeRepositoryActionAsync(editContext, context))
            {
            case CrudType.View:
                viewCommand = new NavigateCommand {
                    Uri = UriHelper.Node(Constants.View, collectionAlias, entityVariant, parentId, id)
                };
                break;

            case CrudType.Edit:
                viewCommand = new NavigateCommand {
                    Uri = UriHelper.Node(Constants.Edit, collectionAlias, entityVariant, parentId, id)
                };
                break;

            case CrudType.Update:
                await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalUpdateAsync(id ?? throw new InvalidOperationException(), parentId, editContext.Entity, relationContainer));

                viewCommand = new ReloadCommand(id);
                break;

            case CrudType.Insert:
                var entity = await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalInsertAsync(parentId, editContext.Entity, relationContainer));

                if (entity == null)
                {
                    throw new Exception("Inserting the new entity failed.");
                }
                editContext.SwapEntity(entity);
                viewCommand = new NavigateCommand {
                    Uri = UriHelper.Node(Constants.Edit, collectionAlias, entityVariant, parentId, editContext.Entity.Id)
                };
                break;

            case CrudType.Delete:
                await EnsureCorrectConcurrencyAsync(() => collection.Repository.InternalDeleteAsync(id ?? throw new InvalidOperationException(), parentId));

                viewCommand = new NavigateCommand {
                    Uri = UriHelper.Collection(Constants.List, collectionAlias, parentId)
                };
                break;

            case CrudType.None:
                viewCommand = new NoOperationCommand();
                break;

            case CrudType.Refresh:
                viewCommand = new ReloadCommand();
                break;

            case CrudType.Return:
                viewCommand = new ReturnCommand();
                break;

            default:
                throw new InvalidOperationException();
            }

            await button.ButtonClickAfterRepositoryActionAsync(editContext, context);

            return(viewCommand);
        }
예제 #20
0
        //private DxxUrl CreateDxxUrl() {
        //    var driver = Driver.Value;
        //    var uri = new Uri(Url.Value);
        //    return new DxxUrl(uri, driver, driver.GetNameFromUri(uri, "link"), IsMain ? "from main" : "from sub");
        //}

        private void InitializeCommands()
        {
            GoBackCommand.Subscribe(() => {
                GoBack();
            });
            GoForwardCommand.Subscribe(() => {
                GoForward();
            });
            ReloadCommand.Subscribe(() => {
                Reload();
            });
            StopCommand.Subscribe(() => {
                Stop();
            });
            BookmarkCommand.Subscribe((v) => {
                if (string.IsNullOrEmpty(v) || !v.StartsWith("http"))
                {
                    IsBookmarked.Value = false;
                    return;
                }
                if (IsBookmarked.Value)
                {
                    Bookmarks.Value.AddBookmark("", v);
                }
                else
                {
                    Bookmarks.Value.RemoveBookmark(v);
                    Url.Value = v;
                }
            });
            NavigateCommand.Subscribe((v) => {
                Navigate(v);
            });
            ClearURLCommand.Subscribe((v) => {
                Url.Value = "";
            });
            AnalyzeCommand.Subscribe((v) => {
                if (v == null)
                {
                    v = Url.Value;
                }
                var aw = new DxxAnalysisWindow(v);
                //aw.Owner = Owner;
                aw.Show();
            });
            CopyCommand.Subscribe((v) => {
                Clipboard.SetData(DataFormats.Text, v);
            });
            DownloadCommand.Subscribe(() => {
                if (IsTarget.Value || IsContainer.Value)
                {
                    DxxDriverManager.Instance.Download(Url.Value, null, "");
                }
            });
            ListingCommand.Subscribe(async() => {
                if (IsContainerList.Value)
                {
                    var uri     = new Uri(Url.Value);
                    var dxxUrl  = new DxxUrl(uri, Driver.Value, Driver.Value.GetNameFromUri(uri), "");
                    var targets = await Driver.Value.LinkExtractor.ExtractTargets(dxxUrl);
                    if (targets != null && targets.Count > 0)
                    {
                        TargetList.Value = new ObservableCollection <DxxTargetInfo>(targets);
                    }
                    else
                    {
                        TargetList.Value?.Clear();
                    }
                }
            });

            SetupDriverCommand.Subscribe(() => {
                DxxDriverManager.Instance.Setup(Driver.Value, Owner);
            });

            FrameSelectCommand.Subscribe((v) => {
                if (IsMain)
                {
                    RequestLoadInSubview.OnNext(v);
                }
                else
                {
                    Navigate(v);
                }
            });
        }
예제 #21
0
        public async Task <ViewCommand> ProcessListActionAsync(UsageType usageType, string collectionAlias, ParentPath?parentPath, IEnumerable <EditContext> editContexts, string actionId, object?customData)
        {
            var collection = _collectionProvider.GetCollection(collectionAlias);

            var button = collection.FindButton(actionId);

            if (button == null)
            {
                throw new Exception($"Cannot determine which button triggered action for collection {collectionAlias}");
            }

            var parent = await _parentService.GetParentAsync(parentPath);

            var rootEditContext = await GetRootEditContextAsync(usageType, collectionAlias, parent);

            var entity = await EnsureCorrectConcurrencyAsync(() => collection.Repository.NewAsync(parent, collection.EntityVariant.Type));

            await EnsureAuthorizedUserAsync(rootEditContext, button);

            ViewCommand viewCommand;

            var context = new ButtonContext(parent, customData);

            switch (await button.ButtonClickBeforeRepositoryActionAsync(rootEditContext, context))
            {
            case CrudType.Create:
                if (button.EntityVariant == null)
                {
                    throw new InvalidOperationException($"Button of type {CrudType.Create} must an {nameof(button.EntityVariant)}.");
                }
                if (usageType.HasFlag(UsageType.List))
                {
                    viewCommand = new NavigateCommand {
                        Uri = UriHelper.Node(Constants.New, collectionAlias, button.EntityVariant, parentPath, null)
                    };
                }
                else
                {
                    viewCommand = new UpdateParameterCommand
                    {
                        Action          = Constants.New,
                        CollectionAlias = collectionAlias,
                        VariantAlias    = button.EntityVariant.Alias,
                        ParentPath      = parentPath?.ToPathString(),
                        Id = null
                    };
                }
                break;

            case CrudType.Update:
                var contextsToProcess = editContexts.Where(x => x.IsModified()).Where(x => button.RequiresValidForm(x) ? x.IsValid() : true);
                var affectedEntities  = new List <IEntity>();
                foreach (var editContext in contextsToProcess)
                {
                    try
                    {
                        await EnsureAuthorizedUserAsync(editContext, button);

                        EnsureValidEditContext(editContext, button);
                        await EnsureCorrectConcurrencyAsync(() => collection.Repository.UpdateAsync(editContext));

                        affectedEntities.Add(editContext.Entity);
                    }
                    catch (Exception)
                    {
                        // do not care about any exception in this case
                    }
                }
                viewCommand = new ReloadCommand(affectedEntities.SelectNotNull(x => x.Id));
                break;

            case CrudType.None:
                viewCommand = new NoOperationCommand();
                break;

            case CrudType.Refresh:
                viewCommand = new ReloadCommand();
                break;

            case CrudType.Return:
                viewCommand = new NavigateCommand {
                    Uri = UriHelper.Collection(Constants.Edit, collectionAlias, parentPath)
                };
                break;

            case CrudType.Up:
                var(newParentPath, parentCollectionAlias, parentId) = ParentPath.RemoveLevel(parentPath);

                if (parentCollectionAlias == null)
                {
                    return(new NoOperationCommand());
                }

                var parentCollection = _collectionProvider.GetCollection(parentCollectionAlias);

                viewCommand = new NavigateCommand {
                    Uri = UriHelper.Node(
                        usageType.HasFlag(UsageType.Edit) ? Constants.Edit : Constants.List,
                        parentCollectionAlias,
                        parentCollection.EntityVariant,
                        newParentPath,
                        parentId)
                };
                break;

            default:
                throw new InvalidOperationException();
            }

            await button.ButtonClickAfterRepositoryActionAsync(rootEditContext, context);

            return(viewCommand);
        }
        public NotificationViewModel(IReqDB dbss, IDialogService dialog, ICalendar calendar, IToast toast, INetwork net)
        {
            dbs           = dbss;
            this.dialog   = dialog;
            this.calendar = calendar;

            ReloadCommand.Execute(null);
            SelectMessage = new MvxCommand <Req>(async selectedItem =>
            {
                string ifloc = "Not Needed";
                string ifcal = "Not Needed";

                if (selectedItem.ReqLoc == true)
                {
                    ifloc = "Needed";
                }

                if (selectedItem.ReqCal == true)
                {
                    ifcal = "Needed";
                }

                string mes = selectedItem.ReqFrom + "\n" + "Calendar: " + ifcal + "\n" + "Location: " + ifloc + "\n" + "Other Info:" + selectedItem.ReqExtra;

                List <string> Answer = await dialog.Show(mes, "Status Request", "Send", "Dismiss");
                if (Answer[0] == "true")
                {
                    Message.Remove(selectedItem);
                    await DeleteReq(selectedItem.Id);
                    toast.Show("Status Response Sent");
                    string calend = ""; // Calander Events for Today
                    string wifi   = ""; // Wifi Access point of person

                    // Don't send location or Calendar
                    if ((MyGlobals.SelPer.PLocCheck == false || ifloc == "Not Needed") && (MyGlobals.SelPer.PCalCheck == false || ifcal == "Not Needed"))
                    {
                        calend = "";
                        wifi   = "";
                    }
                    // Don't send Calendar
                    else if (MyGlobals.SelPer.PCalCheck == false || ifcal == "Not Needed")
                    {
                        calend = "";
                        wifi   = net.SSID();
                    }
                    // Don't send Location
                    else if (MyGlobals.SelPer.PLocCheck == false || ifloc == "Not Needed")
                    {
                        calend = calendar.returnEvents();
                        wifi   = "";
                    }
                    // Send both.
                    else
                    {
                        calend = calendar.returnEvents();
                        wifi   = net.SSID();
                    }


                    MyGlobals.answer = new Answ
                    {
                        AnsFrom  = selectedItem.ReqTo,
                        AnsTo    = selectedItem.ReqFrom,
                        AnsLoc   = wifi,
                        AnsCal   = calend,
                        AnsExtra = Answer[1]
                    };
                    ShowViewModel <RedirectViewModel>();
                }

                else if (Answer[0] == "false")
                {
                    Message.Remove(selectedItem);
                    await DeleteReq(selectedItem.Id);
                    toast.Show("Status Request Deleted");
                }
            });
        }
 private void UpdateWorkigDirectory()
 {
     WorkingDir = client.DetermineWorkingDirectory();
     ReloadCommand.Execute(null);
 }
예제 #24
0
 public void Reload() => ReloadCommand.Execute().Subscribe();
예제 #25
0
        private static void InitializeCommands()
        {
            ChatCommand.AddCommand("/about", new AboutCommand());
            ChatCommand.AddCommand("/addfriend", new AddFriendCommand());
            AddAdminCommand command = new AddAdminCommand();

            command.AdminFlags = "CanAddAdmin";
            ChatCommand.AddCommand("/addadmin", command);
            AddFlagCommand command2 = new AddFlagCommand();

            command2.AdminFlags = "CanAddFlags";
            ChatCommand.AddCommand("/addflag", command2);
            AnnounceCommand command3 = new AnnounceCommand();

            command3.AdminFlags = "CanAnnounce";
            ChatCommand.AddCommand("/announce", command3);
            BanCommand command4 = new BanCommand();

            command4.AdminFlags = "CanBan";
            ChatCommand.AddCommand("/ban", command4);
            ChatCommand.AddCommand("/friends", new FriendsCommand());
            GetFlagsCommand command5 = new GetFlagsCommand();

            command5.AdminFlags = "CanGetFlags";
            ChatCommand.AddCommand("/getflags", command5);
            GiveItemCommand command6 = new GiveItemCommand();

            command6.AdminFlags = "CanGiveItem";
            ChatCommand.AddCommand("/give", command6);
            GodModeCommand command7 = new GodModeCommand();

            command7.AdminFlags = "CanGodMode";
            ChatCommand.AddCommand("/god", command7);
            ChatCommand.AddCommand("/help", new HelpCommand());
            ChatCommand.AddCommand("/history", new HistoryCommand());
            SpawnItemCommand command8 = new SpawnItemCommand();

            command8.AdminFlags = "CanSpawnItem";
            ChatCommand.AddCommand("/i", command8);
            InstaKOCommand command9 = new InstaKOCommand();

            command9.AdminFlags = "CanInstaKO";
            ChatCommand.AddCommand("/instako", command9);
            KickCommand command10 = new KickCommand();

            command10.AdminFlags = "CanKick";
            ChatCommand.AddCommand("/kick", command10);
            KillCommand command11 = new KillCommand();

            command11.AdminFlags = "CanKill";
            ChatCommand.AddCommand("/kill", command11);
            LoadoutCommand command12 = new LoadoutCommand();

            command12.AdminFlags = "CanLoadout";
            ChatCommand.AddCommand("/loadout", command12);
            ChatCommand.AddCommand("/motd", new MOTDCommand());
            MuteCommand command13 = new MuteCommand();

            command13.AdminFlags = "CanMute";
            ChatCommand.AddCommand("/mute", command13);
            ChatCommand.AddCommand("/location", new LocationCommand());
            ChatCommand.AddCommand("/ping", new PingCommand());
            ChatCommand.AddCommand("/players", new PlayersCommand());
            ChatCommand.AddCommand("/pm", new PrivateMessagesCommand());
            ReloadCommand command14 = new ReloadCommand();

            command14.AdminFlags = "CanReload";
            ChatCommand.AddCommand("/reload", command14);
            RemoveAdminCommand command15 = new RemoveAdminCommand();

            command15.AdminFlags = "CanDeleteAdmin";
            ChatCommand.AddCommand("/unadmin", command15);
            ChatCommand.AddCommand("/r", new ReplyCommand());
            ChatCommand.AddCommand("/rules", new RulesCommand());
            SaveAllCommand command16 = new SaveAllCommand();

            command16.AdminFlags = "CanSaveAll";
            ChatCommand.AddCommand("/saveall", command16);
            MasterAdminCommand command17 = new MasterAdminCommand();

            command17.AdminFlags = "RCON";
            ChatCommand.AddCommand("/setmasteradmin", command17);
            ChatCommand.AddCommand("/share", new ShareCommand());
            ChatCommand.AddCommand("/starter", new StarterCommand());
            TeleportHereCommand command18 = new TeleportHereCommand();

            command18.AdminFlags = "CanTeleport";
            ChatCommand.AddCommand("/tphere", command18);
            TeleportToCommand command19 = new TeleportToCommand();

            command19.AdminFlags = "CanTeleport";
            ChatCommand.AddCommand("/tpto", command19);
            UnbanCommand command20 = new UnbanCommand();

            command20.AdminFlags = "CanUnban";
            ChatCommand.AddCommand("/unban", command20);
            ChatCommand.AddCommand("/unfriend", new UnfriendCommand());
            RemoveFlagsCommand command21 = new RemoveFlagsCommand();

            command21.AdminFlags = "CanUnflag";
            ChatCommand.AddCommand("/unflag", command21);
            UnmuteCommand command22 = new UnmuteCommand();

            command22.AdminFlags = "CanUnmute";
            ChatCommand.AddCommand("/unmute", command22);
            ChatCommand.AddCommand("/unshare", new UnshareCommand());
            WhiteListAddCommand command23 = new WhiteListAddCommand();

            command23.AdminFlags = "CanWhiteList";
            ChatCommand.AddCommand("/addwl", command23);
            ShutDownCommand command24 = new ShutDownCommand();

            command24.AdminFlags = "CanShutdown";
            ChatCommand.AddCommand("/shutdown", command24);
            InstaKOAllCommand command25 = new InstaKOAllCommand();

            command25.AdminFlags = "CanInstaKOAll";
            ChatCommand.AddCommand("/instakoall", command25);
        }
예제 #26
0
        private static void InitializeCommands()
        {
            // AdminComponent
            ChatCommand.AddCommand("/ah", new AdminHelpCommand());             // Admin 1
            ChatCommand.AddCommand("/traer", new TeleportHereCommand());       // Nivel 1
            ChatCommand.AddCommand("/ir", new TeleportToCommand());            // Nivel 1
            ChatCommand.AddCommand("/a", new AdminChatCommand());              // Nivel 1
            ChatCommand.AddCommand("/mutear", new MuteCommand());              // Nivel 1
            ChatCommand.AddCommand("/vercuenta", new ShowAccountCommand());    // Admin 1

            ChatCommand.AddCommand("/desmutear", new UnmuteCommand());         // Nivel 1
            ChatCommand.AddCommand("/anuncio", new AnnounceCommand());         // Nivel 2
            ChatCommand.AddCommand("/god", new GodModeCommand());              // Nivel 2
            ChatCommand.AddCommand("/adminkit", new AdminKitCommand());        // Nivel 2
            ChatCommand.AddCommand("/day", new DayCommand());                  // Nivel 2
            ChatCommand.AddCommand("/ban", new BanCommand());                  // Nivel 3
            ChatCommand.AddCommand("/unban", new UnbanCommand());              // Nivel 3
            ChatCommand.AddCommand("/unbanip", new UnBanIPCommand());          // Nivel 3
            ChatCommand.AddCommand("/steam", new GetSteamIDCommand());
            ChatCommand.AddCommand("/ao", new AdminGeneralChatCommand());      // Admin 4
            ChatCommand.AddCommand("/payday", new PayDayCommand());            // Admin 4
            ChatCommand.AddCommand("/limpiarinv", new ClearInvCommand());      // Admin 3
            ChatCommand.AddCommand("/saveloc", new SaveLocationCommand());     // Admin 5
            ChatCommand.AddCommand("/i", new SpawnItemCommand());              // Admin 5
            ChatCommand.AddCommand("/dar", new GiveItemCommand());             // Admin 5
            ChatCommand.AddCommand("/darmelider", new SetClanLeaderCommand()); // Admin 5
            ChatCommand.AddCommand("/daradmin", new DarAdminCommand());        // Nivel 6
            ChatCommand.AddCommand("/instako", new InstaKOCommand());
            ChatCommand.AddCommand("/instakoall", new InstaKOAllCommand());
            ChatCommand.AddCommand("/kick", new KickCommand());
            ChatCommand.AddCommand("/spawner", new BuyCommand());
            ChatCommand.AddCommand("/evento", new SellCommand());
            ChatCommand.AddCommand("/amg", new RustPP.Components.FriendComponent.Commands.FriendsCommand());


            // AuthComponent
            ChatCommand.AddCommand("/login", new LoginCommand());
            ChatCommand.AddCommand("/report", new ErrorCommand("/reportar"));
            ChatCommand.AddCommand("/reportar", new ReportCommand());
            ChatCommand.AddCommand("/tp", new TPCommand());
            ChatCommand.AddCommand("/registro", new RegisterCommand());
            ChatCommand.AddCommand("/pagar", new PagarCommand());
            ChatCommand.AddCommand("/cuenta", new AccountCommand()); // Logged
            ChatCommand.AddCommand("/farm", new FarmCommand());      // Logged
            ChatCommand.AddCommand("/creditos", new AboutCommand());
            ChatCommand.AddCommand("/g", new ShoutCommand());
            ChatCommand.AddCommand("/duda", new DudaCommand());
            ChatCommand.AddCommand("/o", new GeneralChatCommand());
            ChatCommand.AddCommand("/report", new ErrorCommand("/reportar"));
            ChatCommand.AddCommand("/reportar", new ReportCommand());
            ChatCommand.AddCommand("/addfriend", new AddFriendCommand());
            ChatCommand.AddCommand("/r", new ReplyCommand());
            ChatCommand.AddCommand("/rules", new ErrorCommand("/reglas"));
            ChatCommand.AddCommand("/reglas", new RulesCommand());
            ChatCommand.AddCommand("/friends", new ErrorCommand("/amigos"));
            ChatCommand.AddCommand("/amigos", new FriendsCommand());
            ChatCommand.AddCommand("/help", new ErrorCommand("/ayuda"));
            ChatCommand.AddCommand("/ayuda", new HelpCommand());
            ChatCommand.AddCommand("/historial", new HistoryCommand());
            ChatCommand.AddCommand("/motd", new MOTDCommand());
            ChatCommand.AddCommand("/loc", new ErrorCommand("/ubicacion"));
            ChatCommand.AddCommand("/location", new ErrorCommand("/ubicacion"));
            ChatCommand.AddCommand("/ubicacion", new LocationCommand());
            ChatCommand.AddCommand("/ping", new PingCommand());
            ChatCommand.AddCommand("/players", new PlayersCommand());
            ChatCommand.AddCommand("/owner", new DuenoCommand());
            ChatCommand.AddCommand("/pm", new ErrorCommand("/w"));
            ChatCommand.AddCommand("/w", new PrivateMessagesCommand());
            ChatCommand.AddCommand("/share", new ShareCommand());
            ChatCommand.AddCommand("/starter", new StarterCommand());
            ChatCommand.AddCommand("/unfriend", new UnfriendCommand());
            ChatCommand.AddCommand("/unshare", new UnshareCommand());
            ChatCommand.AddCommand("/kit", new KitCommand());
            ChatCommand.AddCommand("/armorparts", new CanjeArmorCommand());
            ChatCommand.AddCommand("/weaponparts", new CanjeWeaponsCommand());
            // Tienda
            ChatCommand.AddCommand("/vender", new ErrorCommand("/tienda"));
            ChatCommand.AddCommand("/comprar", new ErrorCommand("/tienda"));
            ChatCommand.AddCommand("/tienda", new ShopCommand());
            ChatCommand.AddCommand("/tiendachat", new ToggleShopCommand());
            ChatCommand.AddCommand("/confirmar", new ConfirmCommand());
            // Clans Component

            ChatCommand.AddCommand("/crearclan", new CreateClanCommand());
            ChatCommand.AddCommand("/clanes", new ClansCommand());
            ChatCommand.AddCommand("/clan", new ClanCommand());
            ChatCommand.AddCommand("/aceptar", new AceptarCommand());
            ChatCommand.AddCommand("/f", new ClanChatCommand());

            //DonoComponent
            ChatCommand.AddCommand("/dono", new ErrorCommand("/prop"));
            ChatCommand.AddCommand("/prop", new DonoCommand());

            //UtilityComponent
            ChatCommand.AddCommand("/fps", new FPSCommand());
            /* Dar Admin */
            AddAdminCommand command = new AddAdminCommand();

            command.AdminFlags = "CanAddAdmin";
            ChatCommand.AddCommand("/addadmin", command);
            /* Dar Flag */
            AddFlagCommand command2 = new AddFlagCommand();

            command2.AdminFlags = "CanAddFlags";
            ChatCommand.AddCommand("/addflag", command2);
            /* Anuncio */


            /* Ban */


            /* Obtener Flags */
            GetFlagsCommand command5 = new GetFlagsCommand();

            command5.AdminFlags = "CanGetFlags";
            ChatCommand.AddCommand("/getflags", command5);
            /* Dar Items */



            KillCommand command11 = new KillCommand();

            command11.AdminFlags = "CanKill";
            ChatCommand.AddCommand("/kill", command11);

            LoadoutCommand command12 = new LoadoutCommand();

            command12.AdminFlags = "CanLoadout";
            ChatCommand.AddCommand("/loadout", command12);



            ReloadCommand command14 = new ReloadCommand();

            command14.AdminFlags = "CanReload";
            ChatCommand.AddCommand("/reload", command14);

            RemoveAdminCommand command15 = new RemoveAdminCommand();

            command15.AdminFlags = "CanDeleteAdmin";
            ChatCommand.AddCommand("/unadmin", command15);

            SaveAllCommand command16 = new SaveAllCommand();

            command16.AdminFlags = "CanSaveAll";
            ChatCommand.AddCommand("/saveall", command16);

            MasterAdminCommand command17 = new MasterAdminCommand();

            command17.AdminFlags = "RCON";
            ChatCommand.AddCommand("/setmasteradmin", command17);



            RemoveFlagsCommand command21 = new RemoveFlagsCommand();

            command21.AdminFlags = "CanUnflag";
            ChatCommand.AddCommand("/unflag", command21);



            WhiteListAddCommand command23 = new WhiteListAddCommand();

            command23.AdminFlags = "CanWhiteList";
            ChatCommand.AddCommand("/addwl", command23);

            ShutDownCommand command24 = new ShutDownCommand();

            command24.AdminFlags = "CanShutdown";
            ChatCommand.AddCommand("/shutdown", command24);
        }
예제 #27
0
        public MainWindowViewModel()
        {
            Op = new Operation(
                //new MockWorker() ??
                //new NetshWorker() ??
                new NativeWifiWorker() as IWlanWorker);

            this.Profiles = Op.Profiles.ToReadOnlyReactiveCollection(x => new ProfileItemViewModel(x));

            #region AutoReloadEnabled/Suspended/ConfigMode

            IsAutoReloadEnabled = Op
                                  .ToReactivePropertyAsSynchronized(x => x.IsAutoReloadEnabled);

            IsSuspended = Op
                          .ToReactivePropertyAsSynchronized(x => x.IsSuspended);

            IsConfigMode = new ReactiveProperty <bool>();

            IsAutoReloadEnabled
            .Merge(IsSuspended)
            .Where(x => x)
            .Subscribe(_ => IsConfigMode.Value = false);

            IsConfigMode
            .Where(x => x)
            .Subscribe(_ => IsAutoReloadEnabled.Value = false);

            #endregion

            #region Load

            IsLoading = Op.IsLoading
                        .Where(_ => !Op.IsWorking.Value)
                        //.Select(x => Observable.Empty<bool>()
                        //	.Delay(TimeSpan.FromMilliseconds(10))
                        //	.StartWith(x))
                        //.Concat()
                        .ObserveOnUIDispatcher()
                        .ToReadOnlyReactiveProperty();

            ReloadCommand = IsLoading
                            .Select(x => !x)
                            .ToReactiveCommand();
            ReloadCommand
            .Subscribe(async _ => await Op.LoadProfilesAsync(true));

            Profiles
            .ObserveElementObservableProperty(x => x.Position)
            .Throttle(TimeSpan.FromMilliseconds(10))
            .ObserveOn(SynchronizationContext.Current)
            .Subscribe(_ => ProfilesView.Refresh());                     // ListCollectionView.Refresh method seems not thread-safe.

            #endregion

            #region Work

            IsNotWorking = Op.IsWorking
                           .Select(x => !x)
                           .StartWith(true)      // This is necessary for initial query.
                           .ObserveOnUIDispatcher()
                           .ToReadOnlyReactiveProperty();

            // Query for a profile which is selected.
            var querySelectedProfiles = Profiles
                                        .ObserveElementObservableProperty(x => x.IsSelected)
                                        .Where(x => x.Value)
                                        .Select(x => x.Instance)
                                        .Publish();

            // Query for the selected profile which is connected or disconnected.
            var queryConnectedProfiles = Profiles
                                         .ObserveElementObservableProperty(x => x.IsConnected)
                                         .Where(x => x.Instance.IsSelected.Value)
                                         .Select(x => x.Instance)
                                         .Publish();

            // Query for the selected profile which changes to be available or unavailable.
            var queryAvailableProfiles = Profiles
                                         .ObserveElementObservableProperty(x => x.IsAvailable)
                                         .Where(x => x.Instance.IsSelected.Value)
                                         .Select(x => x.Instance)
                                         .Publish();

            #region MoveUp

            var queryMoveUp = querySelectedProfiles
                              .Select(x => x.Position.Value > 0);

            MoveUpCommand = new[] { IsNotWorking, queryMoveUp }
            .CombineLatestValuesAreAllTrue()
            .ToReactiveCommand();
            MoveUpCommand
            .Subscribe(async _ => await Op.MoveUpProfileAsync());

            #endregion

            #region MoveDown

            var queryMoveDown = querySelectedProfiles
                                .Select(x => x.Position.Value < x.PositionCount.Value - 1);

            MoveDownCommand = new[] { IsNotWorking, queryMoveDown }
            .CombineLatestValuesAreAllTrue()
            .ToReactiveCommand();
            MoveDownCommand
            .Subscribe(async _ => await Op.MoveDownProfileAsync());

            #endregion

            #region Delete

            DeleteCommand = IsNotWorking
                            .ToReactiveCommand();
            DeleteCommand
            .Subscribe(async _ => await Op.DeleteProfileAsync());

            #endregion

            #region Connect

            var queryConnect = Observable.Merge(querySelectedProfiles, queryConnectedProfiles, queryAvailableProfiles)
                               .Select(x => !x.IsConnected.Value && x.IsAvailable.Value);

            ConnectCommand = new[] { IsNotWorking, queryConnect }
            .CombineLatestValuesAreAllTrue()
            .ToReactiveCommand();
            ConnectCommand
            .Subscribe(async _ => await Op.ConnectNetworkAsync());

            #endregion

            #region Disconnect

            var queryDisconnect = Observable.Merge(querySelectedProfiles, queryConnectedProfiles)
                                  .Select(x => x.IsConnected.Value);

            DisconnectCommand = new[] { IsNotWorking, queryDisconnect }
            .CombineLatestValuesAreAllTrue()
            .ToReactiveCommand();
            DisconnectCommand
            .Subscribe(async _ => await Op.DisconnectNetworkAsync());

            #endregion

            querySelectedProfiles.Connect();
            queryConnectedProfiles.Connect();
            queryAvailableProfiles.Connect();

            #endregion
        }