Exemplo n.º 1
0
 public static void AddCommandItem(this ItemCollection items,
                                   string header, Action <object> action, Predicate <object> canExecute = null, string buttonLabel = null)
 => items.Add(new MenuItem
 {
     Header  = header,
     Command = R2Command.Relay(action, canExecute, buttonLabel)
 });
Exemplo n.º 2
0
        public SectionRowInspectorVM(SectionColxnsRow sectionColxnsRow, ITenantDBsDir dir) : base(dir)
        {
            MainRow         = sectionColxnsRow;
            EditPRNumberCmd = R2Command.Relay(_ => EditPRNumber(_), _ => CanEditPRNumber(), "Edit PR Number");

            MainRow.Details.ItemOpened += (s, e) => SoaViewer.Show(e.Lease, dir);
            SetCaption($"Collections from “{MainRow?.Section}” by {MainRow.Collector}");
        }
Exemplo n.º 3
0
        public CollectorsMainVM(ITenantDBsDir appArguments) : base(appArguments)
        {
            var mkt = appArguments.MarketState;

            Rows              = new MainListVM(mkt.Collectors, appArguments);
            ToolBar           = new MainToolbarVM(this);
            EncodeNewDraftCmd = R2Command.Relay(EncodeNewDraft);
        }
Exemplo n.º 4
0
 public ActiveLeasesVM(AppArguments appArguments) : base(appArguments.MarketState.ActiveLeases, appArguments, false)
 {
     Crud = new LeaseCrudVM(AppArgs.MarketState.ActiveLeases, AppArgs);
     AddStallToTenantCmd   = R2Command.Relay(AddStallToTenant, _ => Crud.CanEncodeNewDraft(), "Add another Stall to this Tenant");
     EditThisLeaseCmd      = R2Command.Relay(EditThisLease, _ => CanEditRecord(Rows.CurrentItem?.DTO), "Edit this Lease");
     EditTenantInfoCmd     = R2Command.Relay(EditThisLease, _ => AppArgs.CanEditTenantInfo(false), "Edit Tenant Info");
     TerminateThisLeaseCmd = R2Command.Relay(TerminateThisLease, _ => AppArgs.CanTerminateteLease(false), "Terminate this Lease");
 }
Exemplo n.º 5
0
        private void CreateCommands()
        {
            StartUploadCmd = R2Command.Async(StartUpload,
                                             x => CanUpload(), "Upload Package");

            StopUploadCmd = R2Command.Relay(StopUpload,
                                            x => _pkgUploadr.IsUploading, "stop uploading");
        }
Exemplo n.º 6
0
        public AllocationsListVM()
        {
            AddDebitCmd  = R2Command.Relay(_ => AddEntry(-1), null, "Add Debit entry");
            AddCreditCmd = R2Command.Relay(_ => AddEntry(+1), null, "Add Credit entry");

            this.ItemOpened  += AllocationsListVM_ItemOpened;
            this.ItemDeleted += AllocationsListVM_ItemDeleted;
        }
Exemplo n.º 7
0
 public MainWindowVMBase(TArg appArguments)
 {
     AppArgs        = appArguments;
     RefreshCmd     = R2Command.Async(DoRefresh, _ => !IsBusy, "Refresh");
     CloseWindowCmd = R2Command.Relay(CloseWindow, null, "Close Window");
     //SetCaption($"as {AppArgs?.Credentials?.NameAndRole ?? "Anonymous"}");
     SetCaption(".");
 }
Exemplo n.º 8
0
 public FilteredListVMBase(MainWindowVM mainWindowVM, ITenantDBsDir dir)
     : base(null, dir, false)
 {
     Main = mainWindowVM;
     EncodeNewDraftCmd = CreateEncodeNewDraftCmd(dir);
     PrintCmd          = R2Command.Relay(() => _printRequested?.Raise(), null, "Print");
     FillSectionsList();
 }
 public UpdatedFileNotifier(string fileToWatch)
 {
     WatchedFile = fileToWatch;
     ExecuteCmd  = R2Command.Relay(OnExecuteClick);
     if (!fileToWatch.IsBlank())
     {
         InitializeFileWatcher();
     }
 }
Exemplo n.º 10
0
 public AllocationsListVM(FundReqCrudVM fundReqCrudVM)
 {
     _crud                    = fundReqCrudVM;
     _arg                     = _crud.AppArgs;
     _accts                   = GetGLAccounts();
     AddDebitCmd              = R2Command.Relay(_ => AddNewItem("Debit", -1), null, "Add Debit entry");
     AddCreditCmd             = R2Command.Relay(_ => AddNewItem("Credit", +1), null, "Add Credit entry");
     Items.CollectionChanged += Items_CollectionChanged;
 }
Exemplo n.º 11
0
 public IssuedChequesListVM(ITenantDBsDir dir)
     : base(dir.Vouchers.PreparedCheques, dir, false)
 {
     Caption           = "Issued Cheques";
     ViewVoucherCmd    = R2Command.Relay(_ => OnItemOpened(ItemsList.CurrentItem), null, "View Voucher Details");
     PrintVoucherCmd   = R2Command.Relay(PrintVoucher, null, "Print Cheque Voucher");
     EditIssuanceCmd   = R2Command.Relay(EditIssuanceDetails, _ => AppArgs.CanIssueChequeToPayee(false), "Edit Issuance Details");
     TakeBackIssuedCmd = R2Command.Relay(TakeBackIssuedCheque, _ => CanTakeBackIssuedCheque(), "Take Back Issued Cheque");
 }
Exemplo n.º 12
0
        public AdHocJobCmdsVM(MainWindowVM mainWindowVM)
        {
            _main = mainWindowVM;
            _dir  = _main.AppArgs;

            AdHocJobCmd1 = R2Command.Relay(_ => RunAdHoc(1), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 1");
            AdHocJobCmd2 = R2Command.Relay(_ => RunAdHoc(2), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 2");
            AdHocJobCmd3 = R2Command.Relay(_ => RunAdHoc(3), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 3");
        }
Exemplo n.º 13
0
 public ProblemReporter1VM(IMessageBroadcastClient messageBroadcastListener,
                           ClientStateComposer1 clientStateComposer1)
 {
     _client         = messageBroadcastListener;
     _composr        = clientStateComposer1;
     ShowDialogueCmd = R2Command.Relay(ShowDialogueWindow, _ => !IsBusy, IDLE_STATUS);
     SubmitReportCmd = R2Command.Async(SendProblemReport, _ => !IsBusy, "Submit");
     SubmitReportCmd.DisableWhenDone = true;
     SetStatus(IDLE_STATUS);
 }
Exemplo n.º 14
0
 public AdHocJobCmdsVM(MainWindowVM mainWindowVM)
 {
     _main        = mainWindowVM;
     _dir         = _main.AppArgs;
     AdHocJobCmd1 = R2Command.Relay(_ => RunAdHoc(1), null, "Run Ad Hoc Command 1");
     AdHocJobCmd2 = R2Command.Relay(_ => RunAdHoc(2), null, "Run Ad Hoc Command 2");
     AdHocJobCmd3 = R2Command.Relay(_ => RunAdHoc(3), null, "Run Ad Hoc Command 3");
     AdHocJobCmd4 = R2Command.Relay(_ => RunAdHoc(4), null, "Run Ad Hoc Command 4");
     AdHocJobCmd5 = R2Command.Relay(_ => RunAdHoc(5), null, "Run Ad Hoc Command 5");
 }
Exemplo n.º 15
0
        public PostAndCloseVM(MainWindowVM mainWindowVM)
        {
            Main            = mainWindowVM;
            PostAndCloseCmd = R2Command.Relay(ConfirmExecution, _ => CanPostAndClose(), "Post & Close");

            if (Main.CanReview)
            {
                _respondr = new ApprovalResponderVM(Main);
            }
        }
Exemplo n.º 16
0
        public FileWatcherVMBase(IThrottledFileWatcher throttledFileWatcher,
                                 SharedLogListVM commonLogListVM)
        {
            _log                 = commonLogListVM;
            _watchr              = throttledFileWatcher;
            _watchr.FileChanged += _watchr_FileChanged;

            StartWatchingCmd = R2Command.Relay(StartWatchingFile);
            StopWatchingCmd  = R2Command.Relay(StopWatchingFile);
        }
Exemplo n.º 17
0
 public DailyStatusReportVM(ITenantDBsDir dir) : base(dir)
 {
     MinDate         = dir.Collections.AllDates().First();
     MaxDate         = dir.Collections.LastPostedDate();
     ReportDate      = MaxDate;
     PreviousDateCmd = R2Command.Relay(() => ReportDate = ReportDate.AddDays(-1),
                                       _ => ReportDate > MinDate, "Previous Day");
     NextDateCmd = R2Command.Relay(() => ReportDate = ReportDate.AddDays(1),
                                   _ => ReportDate < MaxDate, "Next Day");
 }
Exemplo n.º 18
0
        public SoloFileWatcherVM(IThrottledFileWatcher throttledFileWatcher,
                                 IChangeSender changeSender)
        {
            _watchr              = throttledFileWatcher;
            Sender               = changeSender;
            _watchr.FileChanged += _watchr_FileChanged;

            StartWatchingCmd = R2Command.Relay(StartWatchingLDB);
            StopWatchingCmd  = R2Command.Relay(StopWatchingLDB);
        }
Exemplo n.º 19
0
 public AllInactiveLeasesVM(MainWindowVM main, ITenantDBsDir dir) : base(main, dir)
 {
     AddStallToTenantCmd   = LeaseCRUD1VM.GetAddStallToTenantCmd(this);
     RenewInactiveLeaseCmd = LeaseCRUD1VM.GetRenewInactiveLeaseCmd(this);
     UndoTerminationCmd    = R2Command.Relay(UndoTermination,
                                             _ => AppArgs.CanUndoLeaseTermination(false),
                                             "Undo Lease Termination");
     RebuildSoaCmd = R2Command.Async(RebuildSoA, _ => AppArgs.CanRunAdHocTask(false),
                                     "Rebuild Statement of Account");
 }
Exemplo n.º 20
0
 public MainToolbarVM(MainWindowVM mainWindowVM)
 {
     _main = mainWindowVM;
     _args = _main.AppArgs;
     WithOverduesReportCmd = WithOverduesReport.CreateLauncherCmd(_args);
     PrintCurrentListCmd   = R2Command.Relay(PrintCurrentList, null, "Print Current List");
     ExportListToExcelCmd  = R2Command.Relay(ExportListToExcel, null, "Export List to Excel");
     //RunAdHocTask1Cmd      = R2Command.Relay(_ => RunAdHocTask(1), _ => _args.CanRunAdHocTask(false), "Run Ad Hoc Script 1");
     //RunAdHocTask2Cmd      = R2Command.Relay(_ => RunAdHocTask(2), _ => _args.CanRunAdHocTask(false), "Run Ad Hoc Script 2");
     //RunAdHocTask3Cmd      = R2Command.Relay(_ => RunAdHocTask(3), _ => _args.CanRunAdHocTask(false), "Run Ad Hoc Script 3");
 }
Exemplo n.º 21
0
        public static void Add(this MenuItem menu, string label, Action action)
        {
            var mnu = new MenuItem();

            mnu.Command = R2Command.Relay(action, null, label);
            var bnd = new Binding(nameof(IR2Command.CurrentLabel));

            bnd.Source = mnu.Command;
            BindingOperations.SetBinding(mnu, MenuItem.HeaderProperty, bnd);
            menu.Items.Add(mnu);
        }
Exemplo n.º 22
0
 public ConfigEditorVM(IHubClientSettings hubClientSettings,
                       IHubSessionsClient hubSessionsClient)
 {
     _hub             = hubSessionsClient;
     _key             = hubClientSettings.SharedKey;
     EncryptCmd       = R2Command.Relay(EncryptUnsaved, _ => !IsEncrypted, "Encrypt");
     DecryptCmd       = R2Command.Relay(DecryptUnsaved, _ => IsEncrypted, "Decrypt");
     PrettifyCmd      = R2Command.Relay(PrettifyUnsaved, _ => !IsEncrypted, "Prettify");
     SaveCmd          = R2Command.Async(SaveUnsaved, CanSave, "Save");
     PropertyChanged += ConfigEditorVM_PropertyChanged;
 }
Exemplo n.º 23
0
        public ChequeVoucherViewerVM(ChequeVoucherDTO chequeVoucherDTO, ITenantDBsDir tenantDBsDir) : base(tenantDBsDir)
        {
            DTO = chequeVoucherDTO;
            //ClearedDate        = clearedDate;
            EditClearedDateCmd = R2Command.Relay(EditClearedDate, _ => CanEditClearedDate(), "Edit Cleared Date");

            if (!DTO.Request.HasCashInBankEntry())
            {
                DTO.Request.Allocations.AddCashInBankEntry(AppArgs.CurrentBankAcct, DTO.Request.Amount.Value);
            }
        }
Exemplo n.º 24
0
        public AllVoucherRequestsVM(MainWindowVM mainWindowVM) : base(mainWindowVM.AppArgs)
        {
            var args = mainWindowVM.AppArgs;
            var repo = args.Vouchers.AllRequests;

            MainList        = new MainListVM(repo, args, false);
            LaunchWindowCmd = R2Command.Relay(LaunchWindow, null, "View All Voucher Requests");
//#if DEBUG
//            LaunchWindowCmd.ExecuteIfItCan();
//#endif
        }
Exemplo n.º 25
0
        public SignalrServerToggleVM(ISignalRServerSettings signalRServerSettings,
                                     SharedLogListVM commonLogListVM)
        {
            _cfg = signalRServerSettings;
            _log = commonLogListVM;

            StartServerCmd = R2Command.Relay(StartServer);
            StopServerCmd  = R2Command.Async(StopServer);

            StatusChanged += (s, e) => _log.Add(e);
        }
Exemplo n.º 26
0
 public PreparedChequesListVM(ITenantDBsDir dir, VoucherReqsTabVM vouchersTab)
     : base(dir.Vouchers.PreparedCheques, dir, false)
 {
     _main               = vouchersTab;
     Caption             = "Prepared Cheques";
     ViewVoucherCmd      = R2Command.Relay(_ => OnItemOpened(ItemsList.CurrentItem), null, "View Voucher Details");
     PrintVoucherCmd     = R2Command.Relay(PrintVoucher, null, "Print Cheque Voucher");
     EditChequeCmd       = R2Command.Relay(EditChequeDetails, _ => AppArgs.CanInputChequeDetails(false), "Edit Cheque Details");
     RemoveChequeInfoCmd = R2Command.Relay(RemoveChequeInfo, _ => AppArgs.CanInputChequeDetails(false), "Remove Cheque Details");
     MarkAsCancelledCmd  = R2Command.Relay(MarkAsCancelled, _ => AppArgs.CanMarkChequeAsCancelled(false), "Mark Cheque as “Cancelled”");
 }
Exemplo n.º 27
0
        public MainWindowVM(ITenantDBsDir tenantDBsDir) : base(tenantDBsDir)
        {
            AdHocJobsCmds    = new AdHocJobCmdsVM(this);
            ExportToExcelCmd = R2Command.Relay(() => ToExcelRequested.Raise(), null, "Export to Excel");

            Enlist("All Active Leases", _ => new AllActiveLeasesVM(this, _));
            Enlist("All Terminated Leases", _ => new AllInactiveLeasesVM(this, _));
            Enlist("With Backrents or Overdue Rights", _ => new WithBackRentsOrRightsVM(this, _));
            Enlist("Full Tenant Details", _ => new FullTenantDetailsVM(this, _));
            Enlist("Upcoming Birthdays", _ => new UpcomingBirthdaysVM(this, _));
            //todo: "Leases Nearing Rights Expiry"
        }
Exemplo n.º 28
0
        private ItemCountRow SampleRow(string desc)
        {
            var qty = _fke.Int(1, 20);

            return(new ItemCountRow
            {
                TimeScanned = DateTime.Now.AddSeconds(qty),
                Quantity = qty,
                Description = desc,
                DeleteCmd = R2Command.Relay(() => { })
            });
        }
Exemplo n.º 29
0
 internal StallPickerVM(MarketStateDbBase marketStateDB, Window window)
 {
     _mkt = marketStateDB;
     _win = window;
     if (_win != null)
     {
         _win.DataContext = this;
     }
     _occupiedIDs = GetOccupiedStallIDs();
     Sections.SetItems(marketStateDB.Sections.GetAll());
     ContinueCmd = R2Command.Relay(DoContinue, _ => CanContinue(), "Continue");
 }
Exemplo n.º 30
0
        public LeaseBalancesPaneVM(MainWindowVM2 main)
        {
            LeasesList = new LeasesListVM(main);
            ToggleBtn  = R2Command.Relay(ToggleRun, null, "Run");
            ToggleBtn.UpdateLabelOnRun = false;

            main.MasterData.OnAllLeasesMatch += (s, e) =>
            {
                LeasesList.FillLeasesList();
                //ToggleRun();
            };
        }