コード例 #1
0
ファイル: ViewModelExecute.cs プロジェクト: xmaux72/Exrin
 public static IRelayCommand ViewModelExecute(this IExecution sender, IBaseOperation execute, [CallerMemberName] string name = "", object precheck = null)
 {
     return(ViewModelExecute(sender, new BaseViewModelExecute(new List <IBaseOperation>()
     {
         execute
     }), null, name, precheck));
 }
コード例 #2
0
ファイル: ViewModelExecute.cs プロジェクト: maximrub/exrin
 public static IRelayCommand ViewModelExecute(this IExecution sender, IBaseOperation execute, int timeout, [CallerMemberName] string name = "")
 {
     return(ViewModelExecute(sender, new BaseViewModelExecute(new List <IBaseOperation>()
     {
         execute
     }), timeout, name));
 }
コード例 #3
0
ファイル: ViewModelExecute.cs プロジェクト: sk8tz/Exrin
 public static IRelayCommand ViewModelExecute(this IExecution sender, IBaseOperation execute, Func <object, bool> canExecute, [CallerMemberName] string name = "")
 {
     return(ViewModelExecute(sender, new BaseViewModelExecute(new List <IBaseOperation>()
     {
         execute
     }), canExecute, name));
 }
コード例 #4
0
        private void OnOperationFinalized(IBaseOperation operation)
        {
            operationsInProgress.Remove(operation);

            if (operationsInProgress.Any())
            {
                return;
            }

            var errorMessage = LastErrorMessage;

            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                EditorApplication.update -= CheckInternetReachability;
                EditorApplication.update += CheckInternetReachability;

                errorMessage = "You seem to be offline.";
            }

            if (!string.IsNullOrEmpty(errorMessage))
            {
                SetStatusMessage(StatusType.Error, errorMessage);
            }
            else
            {
                SetDefaultMessage(LastUpdateTime);
            }
        }
コード例 #5
0
ファイル: Package.cs プロジェクト: yujunrong/UnityCsReference
        public void Embed(Action <PackageInfo> onSuccess = null)
        {
            if (Current == null || PackageOperationInProgress)
            {
                return;
            }

            var operation = OperationFactory.Instance.CreateEmbedOperation();

            packageOperationInstance       = operation;
            OnEmbedOperationFinalizedEvent = () =>
            {
                EmbedSignal.Operation           = null;
                operation.OnOperationFinalized -= OnEmbedOperationFinalizedEvent;
            };

            OnEmbedOperationSuccessEvent = info =>
            {
                onSuccess?.Invoke(info);
                operation.OnOperationSuccess -= OnEmbedOperationSuccessEvent;
            };

            operation.OnOperationSuccess   += OnEmbedOperationSuccessEvent;
            operation.OnOperationFinalized += OnEmbedOperationFinalizedEvent;
            EmbedSignal.SetOperation(operation);

            operation.EmbedPackageAsync(Current);
        }
コード例 #6
0
 private void OnOperationFinalized(IBaseOperation operation)
 {
     operationsInProgress.Remove(operation);
     if (operationsInProgress.Any())
     {
         return;
     }
     UpdateStatusMessage();
 }
コード例 #7
0
ファイル: Package.cs プロジェクト: xinfushe/UnityCsReference
        internal static void AddFromId(string packageId)
        {
            if (AddRemoveOperationInProgress)
            {
                return;
            }
            var operation = OperationFactory.Instance.CreateAddOperation();

            addRemoveOperationInstance = operation;
            operation.AddPackageAsync(packageId);
        }
コード例 #8
0
 private void UpdateLoading(IBaseOperation operation)
 {
     if (operation == null || operation.IsCompleted)
     {
         SetLoading(false);
     }
     else
     {
         operation.OnOperationFinalized += OnOperationFinalized;
         SetLoading(true);
     }
 }
コード例 #9
0
        internal void OnListOrSearchOperation(IBaseOperation operation)
        {
            if (operation == null || operation.IsCompleted)
            {
                return;
            }
            operationsInProgress.Add(operation);
            operation.OnOperationFinalized += () => { OnOperationFinalized(operation); };
            operation.OnOperationError     += OnOperationError;

            SetStatusMessage(StatusType.Loading, "Loading packages...");
        }
コード例 #10
0
        public override Task <TResult> HandleAsync(IBaseOperation operation,
                                                   IServiceProvider serviceProvider,
                                                   CancellationToken cancellationToken)
        {
            Task <TResult> HandleAsync() => serviceProvider.GetRequiredService <IOperationHandler <TOperation, TResult> >().HandleAsync((TOperation)operation, cancellationToken);

            var filters = serviceProvider.GetServices <IOperationFilter <TOperation, TResult> >();

            return(filters
                   .Reverse()
                   .Aggregate((OperationHandlerDelegate <TResult>)HandleAsync,
                              (next, filter) => () => filter.FilterAsync((TOperation)operation, cancellationToken, next))());
        }
コード例 #11
0
        internal static void AddFromUrl(string url)
        {
            if (AddRemoveOperationInProgress)
            {
                return;
            }
            var operation = OperationFactory.Instance.CreateAddOperation();

            addRemoveOperationInstance = operation;
            // convert SCP-like syntax to SSH URL as currently UPM doesn't support it
            if (url.ToLower().StartsWith("git@"))
            {
                url = "ssh://" + url.Replace(':', '/');
            }
            operation.AddPackageAsync(url);
        }
コード例 #12
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            _operation = PageInitialization.InitializeOperation("chrome");

            _operation.BrowseThisWebSite(ConfigurationManager.AppSettings["website"]);

            _operation.GoToDefaultTab();

            //LOL
            for (int i = 0; i < Int32.Parse(TextBoxClickCount.Text); i++)
            {
                _operation.ClickTheButton();
            }

            _operation.Quit();

            _process.EndSession("drivers".GetValue());
        }
コード例 #13
0
        private IBaseOperation CreateOperation(Models.ISchedulablePlan plan, Options options)
        {
            IBaseOperation result = null;

            switch (options.PlanType)
            {
            case PlanTypeEnum.Backup:
                result = CreateBackupOperation(plan as Models.BackupPlan);
                //result = CreateBackupOperation(plan as Models.BackupPlan);
                break;

            case PlanTypeEnum.Restore:
                result = CreateRestoreOperation(plan as Models.RestorePlan);
                //result = CreateRestoreOperation(plan as Models.RestorePlan);
                break;
            }

            return(result);
        }
コード例 #14
0
        private void Manp_Items_Shown(object sender, EventArgs e)
        {
            DataHolder     dataHolder    = new DataHolder();
            IBaseOperation loadOperation = dataHolder.LoadEnumData();

            if (!loadOperation.Successful)
            {
                OnLoadError(loadOperation.Fail);
                return;
            }
            lookUpItemType.Properties.DataSource      = dataHolder.ItemTypes;
            lookupPriceCalcType.Properties.DataSource = dataHolder.LineCalcTypes;

            if (Id == 0)
            {
                Item = new Item();
            }
            else
            {
                // GET DATA
                Operation <Item> op_item = OperationHandler.GetItemById(Id);
                if (!op_item.Successful)
                {
                    OnLoadError(op_item.Fail);
                    return;
                }
                Item = op_item.Value;
                lookUpItemType.Enabled = false;
            }
            bindTool.BindControl(txtGroup1, nameof(Item.Group1));
            bindTool.BindControl(txtGroup2, nameof(Item.Group2));
            bindTool.BindControl(txtGroup3, nameof(Item.Group3));
            bindTool.BindControl(txtGroup4, nameof(Item.Group4));
            bindTool.BindControl(txtItemCode, nameof(Item.ItemCode));
            bindTool.BindControl(txtItemName, nameof(Item.ItemName));
            bindTool.BindControl(lookUpItemType, nameof(Item.ItemTypeId));
            bindTool.BindControl(lookupPriceCalcType, nameof(Item.LineCalcTypeId));
            bindTool.BindControl(spLength, nameof(Item.Length));
            bindTool.BindControl(spWidth, nameof(Item.Width));
            bindTool.BindControl(chkIsLineService, nameof(Item.IsLineService));
            bindTool.DataObject = Item;
        }
コード例 #15
0
ファイル: Package.cs プロジェクト: xinfushe/UnityCsReference
        internal static void AddFromLocalDisk(string path)
        {
            if (AddRemoveOperationInProgress)
            {
                return;
            }

            var packageJson = PackageJsonHelper.Load(path);

            if (null == packageJson)
            {
                Debug.LogError(string.Format("Invalid package path: cannot find \"{0}\".", path));
                return;
            }

            var operation = OperationFactory.Instance.CreateAddOperation();

            addRemoveOperationInstance = operation;
            operation.AddPackageAsync(packageJson.PackageInfo);
        }
コード例 #16
0
ファイル: Package.cs プロジェクト: Hengle/ECSVoxels
        public void Remove()
        {
            if (Current == null || AddRemoveOperationInProgress)
            {
                return;
            }

            var operation = OperationFactory.Instance.CreateRemoveOperation();

            addRemoveOperationInstance      = operation;
            OnRemoveOperationFinalizedEvent = () =>
            {
                RemoveSignal.Operation          = null;
                operation.OnOperationFinalized -= OnRemoveOperationFinalizedEvent;
            };

            operation.OnOperationFinalized += OnRemoveOperationFinalizedEvent;
            RemoveSignal.SetOperation(operation);

            operation.RemovePackageAsync(Current);
        }
コード例 #17
0
ファイル: Package.cs プロジェクト: Hengle/ECSVoxels
        internal void Add(PackageInfo packageInfo)
        {
            if (packageInfo == Current || AddRemoveOperationInProgress)
            {
                return;
            }

            var operation = OperationFactory.Instance.CreateAddOperation();

            addRemoveOperationInstance   = operation;
            OnAddOperationFinalizedEvent = () =>
            {
                AddSignal.Operation             = null;
                operation.OnOperationFinalized -= OnAddOperationFinalizedEvent;
            };

            operation.OnOperationFinalized += OnAddOperationFinalizedEvent;

            AddSignal.SetOperation(operation);
            operation.AddPackageAsync(packageInfo);
        }
コード例 #18
0
ファイル: Package.cs プロジェクト: yujunrong/UnityCsReference
        public void Remove()
        {
            if (Current == null || PackageOperationInProgress)
            {
                return;
            }

            var operation = OperationFactory.Instance.CreateRemoveOperation();

            packageOperationInstance        = operation;
            OnRemoveOperationFinalizedEvent = () =>
            {
                RemoveSignal.Operation          = null;
                operation.OnOperationFinalized -= OnRemoveOperationFinalizedEvent;
                PackageManagerWindow.FetchListOfflineCacheForAllWindows();
            };

            operation.OnOperationFinalized += OnRemoveOperationFinalizedEvent;
            RemoveSignal.SetOperation(operation);

            operation.RemovePackageAsync(Current);
        }
コード例 #19
0
ファイル: Package.cs プロジェクト: yujunrong/UnityCsReference
        internal void Add(PackageInfo packageInfo)
        {
            if (packageInfo == Current || PackageOperationInProgress)
            {
                return;
            }

            var operation = OperationFactory.Instance.CreateAddOperation();

            packageOperationInstance     = operation;
            OnAddOperationFinalizedEvent = () =>
            {
                AddSignal.Operation             = null;
                operation.OnOperationFinalized -= OnAddOperationFinalizedEvent;
                PackageManagerWindow.FetchListOfflineCacheForAllWindows();
            };

            operation.OnOperationFinalized += OnAddOperationFinalizedEvent;

            AddSignal.SetOperation(operation);
            operation.AddPackageAsync(packageInfo);
        }
コード例 #20
0
 public abstract Task <TResult> HandleAsync(IBaseOperation operation,
                                            IServiceProvider serviceProvider,
                                            CancellationToken cancellationToken);
コード例 #21
0
        private void Manp_CardTransaction_Shown(object sender, EventArgs e)
        {
            if (!IsEditMode)
            {
                foreach (Control c in grpCenter.Controls)
                {
                    c.Enabled = false;
                }
                btnOk.Enabled = false;
            }
            List <IBaseOperation> loadOperations = new List <IBaseOperation>();

            IBaseOperation baseOperation = dataHolder.LoadEnumData();

            loadOperations.Add(baseOperation);

            Operation <List <CardView> > op_CardMaster = OperationHandler.GetCardsByUserId(StaticData.CurrentUserId);

            loadOperations.Add(op_CardMaster);

            if (Id != 0)
            {
                Operation <CardFiche> op_ExistingCardFiche = OperationHandler.GetCardFicheById(Id);
                loadOperations.Add(op_ExistingCardFiche);
                cardFiche  = op_ExistingCardFiche.Value;
                creditLine = cardFiche.Lines.Where(x => x.SignType < 0).FirstOrDefault();
                debitLine  = cardFiche.Lines.Where(x => x.SignType > 0).FirstOrDefault();
            }
            else
            {
                cardFiche             = new CardFiche();
                cardFiche.CreatedDate = DateTime.Now;
                cardFiche.CreatedBy   = StaticData.CurrentUserId;
                cardFiche.StatusId    = 11;
            }

            foreach (IBaseOperation ibop in loadOperations)
            {
                if (!ibop.Successful)
                {
                    SetError(ibop.Fail);
                    return;
                }
            }

            Cards     = op_CardMaster.Value;
            CashTypes = dataHolder.CashTypes;
            lookUpCashType.Properties.DataSource         = CashTypes;
            searchLookUpSourceCard.Properties.DataSource = Cards;
            searchLookUpDestCard.Properties.DataSource   = Cards;


            ficheBindTool.BindControl(lookUpCashType, nameof(cardFiche.CashTypeId));
            ficheBindTool.BindControl(txtNote, nameof(cardFiche.Note));
            ficheBindTool.BindControl(txtFicheno, nameof(cardFiche.Ficheno));

            if (creditLine == null)
            {
                creditLine = new CardFicheLine();
            }
            creditLineBindTool.BindControl(searchLookUpSourceCard, nameof(creditLine.CardId));
            creditLineBindTool.BindControl(sourceCurrencyRate, nameof(creditLine.CurrencyRate));
            creditLineBindTool.BindControl(sourceAmount, nameof(creditLine.Total));

            if (debitLine == null)
            {
                debitLine = new CardFicheLine();
            }
            debitLineBindTool.BindControl(searchLookUpDestCard, nameof(debitLine.CardId));
            debitLineBindTool.BindControl(destCurrencyRate, nameof(debitLine.CurrencyRate));
            debitLineBindTool.BindControl(destAmount, nameof(debitLine.Total));

            ficheBindTool.DataObject      = cardFiche;
            creditLineBindTool.DataObject = creditLine;
            debitLineBindTool.DataObject  = debitLine;

            txtDate.Text = cardFiche.CreatedDate.ToString(StaticData.DateTimeFromatStr);

            ControlCurrencies();
            //if (injected)
            //{


            //    //CardView sourceCard = Cards.Where(x => x.Id == sourceCardId).FirstOrDefault();
            //    //lookUpCurrency.EditValue = sourceCard?.CurrencyId;
            //    //searchLookUpSourceCard.EditValue = sourceCard?.Id;
            //    //searchLookUpDestCard.EditValue = destCardId;
            //    //sourceAmount.EditValue = amount;
            //    //txtNote.Text = note;
            //    ////lookUpCurrency.ReadOnly = true;
            //    //cashTransaction.ConnectedFicheId = connectedInvoiceId;
            //}
        }
コード例 #22
0
        private void Run()
        {
            // Load informed plan
            Models.ISchedulablePlan plan = LoadPlan(Options);
            if (plan == null)
            {
                logger.Fatal("The {0} plan with id {1} does not exist.",
                             Options.PlanType.ToString().ToLowerInvariant(), Options.PlanIdentifier);
                ExitShowingHelpText(1);
            }

            Model = plan;

            if (Options.Verbose)
            {
                logger.Info("Running {0} plan #{1}", Options.PlanType.ToString().ToLowerInvariant(), Options.PlanIdentifier);
            }

#if !DEBUG
            try
#endif
            {
                RunningOperation = CreateOperation(plan, Options);

                RunningOperation.Start();

                while (true)
                {
                    if (!IsReleaseVersion && System.Environment.UserInteractive)
                    {
                        if (ConsoleAppHelper.TerminationRequestedEvent.WaitOne(1))
                        {
                            if (RunningOperation != null && RunningOperation.IsRunning)
                            {
                                RunningOperation.Cancel();
                            }
                            else
                            {
                                break;
                            }
                        }
                    }

                    if (RunningOperationEndedEvent.WaitOne(100))
                    {
                        break;
                    }

                    RunningOperation.DoEvents();
                }

                logger.Info("Operation finished.");

                Handler.Client.WaitUntilDone();

                RunningOperation.SendReport();
            }
#if !DEBUG
            catch (Exception ex)
            {
                string message = ex.Message;

                Handler.Send(Commands.ReportError(0, message));
                logger.Error(message);

                if (RunningOperation != null)
                {
                    BaseOperationReport report = RunningOperation.GetReport() as BaseOperationReport;
                    report.OperationStatus = OperationStatus.FAILED;
                    report.AddErrorMessage(message);
                    RunningOperation.SendReport();
                }

                Environment.Exit(1);
            }
#endif

#if DEBUG
            // Wait 10 seconds before exiting, only for debugging purposes.
            Thread.Sleep(10000);
#endif
        }
コード例 #23
0
 private PageLoadErrorEventArgs OnPageLoadError(IBaseOperation op) {
   var handler = PageLoadError;
   var args = new PageLoadErrorEventArgs(op.Error);
   if (handler != null) {
     handler(this, args);
   }
   return args;
 }
コード例 #24
0
 public void Init()
 {
     _operation = PageInitialization.InitializeOperation("chrome");
 }
コード例 #25
0
        private void Manp_FichesNew_Shown(object sender, EventArgs e)
        {
            btnAddCashTran.Enabled          = btnDistributeExpences.Enabled =
                btnOk.Enabled               = searchLookUpCard.Enabled =
                    lookUpWarehouse.Enabled = IsEditMode;

            dataHolder = new DataHolder();
            IBaseOperation loadOper = dataHolder.LoadEnumData();

            if (!loadOper.Successful)
            {
                SetError(loadOper.Fail);
                return;
            }
            loadOper = dataHolder.LoadMasterData();
            if (!loadOper.Successful)
            {
                SetError(loadOper.Fail);
                return;
            }
            searchLookUpCard.Properties.DataSource = dataHolder.Cards;

            rpLookupItem.DataSource               = dataHolder.Items;
            rpLookupItem.DisplayMember            = "ItemName";
            rpLookupItem.ValueMember              = "Id";
            lookUpWarehouse.Properties.DataSource = dataHolder.Warehouses;

            foreach (ItemView item in dataHolder.Items.Where(x => x.IsLineService))
            {
                ToolStripMenuItem menuItem = new ToolStripMenuItem();
                menuItem.Tag    = item.Id;
                menuItem.Text   = item.ItemName;
                menuItem.Click += SrvBlukMenuItem_Click;
                tsBulkAddServices.DropDownItems.Add(menuItem);
            }



            if (isNew)
            {
                Fiche       = new FicheMasterView();
                Fiche.Lines = new List <FicheLineView>();
            }



            else
            {
                Operation <FicheMasterView> op_ExistingFiche = OperationHandler.GetFicheById(Id);
                if (!op_ExistingFiche.Successful)
                {
                    SetError(op_ExistingFiche.Fail);
                    return;
                }
                Fiche        = op_ExistingFiche.Value;
                txtDate.Text = Fiche.CreatedDate.ToString("dd.MM.yyyy");
                DocumentType = dataHolder.DocumentTypes.Where(x => x.Id == Fiche.DocTypeId).First();
                if (CreateInvoiceFromOrderFiche)
                {
                    Fiche.SourceDocument = Fiche.Ficheno;
                    Id = Fiche.Id = 0;
                    Fiche.DocTypeId = 2;
                    btnOk.Text      = "Fakturala";
                }
            }
            if (DocumentType.Id == 1 || DocumentType.Id == 2)
            {
                gvLines.Columns["LineExpense"].Visible = false;
                tabNavigationExpencesPage.PageVisible  = false;
            }
            else
            {
                gvLines.Columns["LineServicesTotal"].Visible = false;
                gvLines.Columns["IsCustomerItem"].Visible    = false;
                gvLines.Columns["IsSketched"].Visible        = false;
                gvLines.Columns["IsTemplated"].Visible       = false;
                gcServicesOfLine.Visible = false;
                gcLines.ContextMenuStrip = null;
                tabNavigationExpencesPage.PageVisible = true;
            }

            bindTool.BindControl(searchLookUpCard, nameof(Fiche.CardId));
            bindTool.BindControl(lookUpWarehouse, nameof(Fiche.SourceWarehouse));
            bindTool.BindControl(txtFicheno, nameof(Fiche.Ficheno));
            bindTool.BindControl(txtNote1, nameof(Fiche.Note1));
            bindTool.BindControl(txtNote2, nameof(Fiche.Note2));
            bindTool.BindControl(txtNote3, nameof(Fiche.Note3));
            bindTool.BindControl(txtNote4, nameof(Fiche.Note4));
            bindTool.BindControl(txtSourceDoc, nameof(Fiche.SourceDocument));
            bindTool.BindControl(spCurrencyRate, nameof(Fiche.CurrencyRate));
            bindTool.DataObject = Fiche;

            if (dataHolder.Warehouses.Count > 0)
            {
                lookUpWarehouse.EditValue = dataHolder.Warehouses.First().Number;
            }

            gcLines.DataSource = null;
            gcLines.DataSource = Fiche.Lines;
            // gcLines.DataSource = Fiche.FicheLines;
            //cmbItemType.SelectedIndex = 0;
            RefreshCashTrans();
        }
コード例 #26
0
ファイル: ViewModelExecute.cs プロジェクト: exrin/Exrin
 public static IRelayCommand ViewModelExecute(this IExecution sender, IBaseOperation execute, [CallerMemberName] string name = "")
 {
     return ViewModelExecute(sender, new BaseViewModelExecute(new List<IBaseOperation>() { execute }), name);
 }