예제 #1
0
 public static void DoExecuteAsync(Func<object> theDelegate, object state, Func<object, object, RunWorkerCompletedEventArgs> completed)
 {
     BackgroundTask _backgroundTask = null;
     _backgroundTask = new BackgroundTask(theDelegate);
     _backgroundTask.Completed += (s, e) => completed(s, e);
     _backgroundTask.Start(state);
 }
        public void SyncFromMainStock()
        {
            IList departmentUsbList = ClientUtility.GetUSBDrives();

            IoC.Get<INormalLoadViewModel>().StartLoading();
            BackgroundTask _backgroundTask = null;
            _backgroundTask = new BackgroundTask(() => SyncFromMain(departmentUsbList));
            _backgroundTask.Completed += (s, e) => SyncToDepartmentCompleted(s, e);
            _backgroundTask.Start(departmentUsbList);
        }
예제 #3
0
        static IBackgroundTask ExecuteOnBackgroundThread(Func<object> backgroundAction, RunWorkerCompletedEventHandler uiCallback, ProgressChangedEventHandler progressChanged)
        {
            var task = new BackgroundTask(backgroundAction);

            if (uiCallback != null)
                task.Completed += uiCallback;

            if (progressChanged != null)
                task.ProgressChanged += progressChanged;

            task.Start(null);

            return task;
        }
예제 #4
0
 public void Save()
 {
     DepartmentPurchaseOrder.DepartmentPurchaseOrderDetails = ObjectConverter.ConvertTo<DepartmentPurchaseOrderDetail>(PurchaseOrderDetails);
     DepartmentPurchaseOrder.PurchasePrice = TotalQuantity;
     DepartmentPurchaseOrder.PurchaseDescription = CreateDescription();
     DepartmentPurchaseOrder.PurchaseQuantity = CreateQuantity();
     if(Changes < 0 )
     {
         MessageBox.Show(" So tien tra chua du");
         return;
     }
     BackgroundTask task = new BackgroundTask(() => DepartmentPurchaseOrderLogic.Add(DepartmentPurchaseOrder));
     task.Completed += task_Completed;
     StartWaitingScreen(0);
     task.Start(DepartmentPurchaseOrder);
 }
 void StockInConfirmEvent(object sender, StockInChoosingArg e)
 {
     StartWaitingScreen(0);
     CoralPOS.Models.StockIn selectedStockIn = e.SelectedStockIn;
     BackgroundTask backgroundTask = new BackgroundTask(() => PopulateStockOutList(selectedStockIn));
     backgroundTask.Completed += backgroundTask_Completed;
     backgroundTask.Start(selectedStockIn);
 }
 public void Choose()
 {
     BackgroundTask task = new BackgroundTask(() => ChooseStockIn(SelectedStockIn));
     task.Completed += new System.ComponentModel.RunWorkerCompletedEventHandler(task_Completed);
     IoC.Get<ICircularLoadViewModel>().StartLoading();
     task.Start(SelectedStockIn);
     //Shutdown();
 }
예제 #7
0
 /// <summary>
 /// Changes the department for evaluate.
 /// </summary>
 public void ChangeDepartmentForEvaluate()
 {
     BackgroundTask backgroundTask = new BackgroundTask(() => PopulateStockTempValidList(SelectedDepartment));
     backgroundTask.Completed += backgroundTask_Completed;
     StartWaitingScreen(0);
     backgroundTask.Start(SelectedDepartment);
 }
 void StockInConfirmEvent(object sender, DepartmentStockInChoosingArg e)
 {
     CoralPOS.Models.DepartmentStockIn selectedStockIn = e.SelectedStockIn;
     BackgroundTask backgroundTask = new BackgroundTask(() => PopulateStockOutList(selectedStockIn));
     backgroundTask.Completed += new System.ComponentModel.RunWorkerCompletedEventHandler(backgroundTask_Completed);
     StartWaitingScreen(0);
     backgroundTask.Start(selectedStockIn);
 }
예제 #9
0
 public void ViewDetail()
 {
     if (_selectedStockIn != null && !string.IsNullOrEmpty(_selectedStockIn.StockInId))
     {
         CoralPOS.Models.StockIn stockIn = SelectedStockIn;
         Flow.Session.Put(FlowConstants.STOCK_IN_SEARCH_RESULT, StockInList);
         BackgroundTask task = new BackgroundTask(()=>LoadStockInAndGoToDetail(stockIn));
         task.Completed += new System.ComponentModel.RunWorkerCompletedEventHandler(task_Completed);
         StartWaitingScreen(0);
         task.Start(stockIn);
     }
 }
예제 #10
0
        public void ViewDetail()
        {
            if (_selectedStockOut != null && _selectedStockOut.StockOutId > 0 )
            {
                CoralPOS.Models.StockOut stockOut = SelectedStockOut;
                Flow.Session.Put(FlowConstants.STOCK_OUT_SEARCH_RESULT, StockOutList);
                BackgroundTask task = new BackgroundTask(() => LoadStockOutAndGoToDetail(stockOut));
                task.Completed += new System.ComponentModel.RunWorkerCompletedEventHandler(task_Completed);
                StartWaitingScreen(0);
                task.Start(stockOut);

            }
        }
예제 #11
0
 public void CreateSyncUSB()
 {
     if (SelectedDepartment.DepartmentId <=0) return;
     IoC.Get<INormalLoadViewModel>().StartLoading();
     BackgroundTask backgroundTask = null;
     backgroundTask = new BackgroundTask(() => CreateSyncUSB(SelectedUSB,SelectedDepartment.DepartmentId));
     backgroundTask.Completed += (s, e) => CreateSyncUSBCompleted(s, e);
     backgroundTask.Start(null);
 }
예제 #12
0
 public void SyncToDepartment()
 {
     SyncToDepartmentObject obj = new SyncToDepartmentObject();
     obj.Department = SelectedDepartment;
     obj.DepartmentInfo = DepartmentInfo;
     obj.ProductMasterInfo = ProductMasterInfo;
     obj.PriceInfo = PriceInfo;
     IoC.Get<INormalLoadViewModel>().StartLoading();
     BackgroundTask _backgroundTask = null;
     _backgroundTask = new BackgroundTask(() => SyncToDepartment(obj));
     _backgroundTask.Completed += (s, e) => SyncToDepartmentCompleted(s, e);
     _backgroundTask.Start(obj);
 }
예제 #13
0
 public void DoExecuteAsync(Func<object>theDelegate, object state)
 {
     _backgroundTask = new BackgroundTask(theDelegate);
     _backgroundTask.Completed += (s, e) => DoExecuteCompleted(this, e);
     _backgroundTask.Start(state);
 }