Пример #1
0
        public async void Save()
        {
            if (Busy)
            {
                return;
            }

            Busy = true;

            if (string.IsNullOrEmpty(Text))
            {
                SaveFailed?.Invoke(this, "Reason is required.");
                Busy = false;
                return;
            }

            var reason = await Services.Host.ReasonService.SaveReason(new Reason()
            {
                Text = Text
            });

            if (string.IsNullOrEmpty(reason.Id))
            {
                SaveFailed?.Invoke(this, "Reason was not saved.");
                Busy = false;
                return;
            }

            SaveComplete?.Invoke(this, EventArgs.Empty);
            Busy = false;

            Device.StartTimer(TimeSpan.FromSeconds(1), Wait);
        }
        public new void complete()
        {
            Game1.playSound("money");
            this.completePause   = 1500;
            this.loader          = (IEnumerator <int>)null;
            Game1.game1.IsSaving = false;

            SaveComplete.Invoke(this, EventArgs.Empty);
        }
Пример #3
0
        async Task ExecuteSaveCommand()
        {
            if (IsNew)
            {
                await CosmosDBService.InsertToDoItem(ToDoItem);
            }
            else
            {
                await CosmosDBService.UpdateToDoItem(ToDoItem);
            }

            SaveComplete?.Invoke(this, new EventArgs());
        }
        public void complete()
        {
            Game1.playSound("money");
            this.completePause   = 1500;
            this.loader          = (IEnumerator <int>)null;
            Game1.game1.IsSaving = false;
            if (!Game1.IsMasterGame || Game1.newDaySync == null || Game1.newDaySync.hasSaved())
            {
                return;
            }
            Game1.newDaySync.flagSaved();

            SaveComplete.Invoke(this, EventArgs.Empty);
        }
        async Task ExecuteSaveCommand()
        {
            var mongoService = new MongoService();

            if (_isNew)
            {
                await mongoService.CreateTask(TheTask);
            }
            else
            {
                await mongoService.UpdateTask(TheTask);
            }

            SaveComplete?.Invoke(this, new EventArgs());
        }
Пример #6
0
        private void butSave_Click(object sender, RoutedEventArgs e)
        {
            APIKey = new APIKeyDataModel()
            {
                APIKey         = FlickrClientID.Text,
                APISecret      = FlickrClientSecret.Text,
                APICallbackUrl = FlickrCallbackUrl.Text,
                Type           = tbAPIType.Text,
                APIName        = tbAPIName.Text,
                DeveloperUri   = tbDeveloperUri.Text
            };

            StorageService.Instance.Storage.Insert(APIKey);

            SaveComplete?.Invoke(null, EventArgs.Empty);
        }
Пример #7
0
        // Function to make a save request to the mongo serive to then add it to the database
        public async Task ExecuteSaveCommand()
        {
            var monoService = new MongoDBServer();

            // Call to service to add a new modules to the database.
            if (_existingModule)
            {
                await monoService.CreateTimetableElement(NewModule);
            }
            else
            {
                await monoService.UpdateModule(NewModule);
            } // End SaveAsync method

            SaveComplete?.Invoke(this, new EventArgs());
        } // End Save Command function
Пример #8
0
 private void SaveAction()
 {
     IsChanged        = false;
     _model.BaseValue = _viewModel.Value;
     _model.Type      = _viewModel.Type;
     if (_isCreate)
     {
         _model.Id = Guid.NewGuid();
         _repo.CreateStat(_model);
     }
     else
     {
         _repo.EditStat(_model);
     }
     CloseWindow();
     SaveComplete?.Invoke(this, _model);
 }
Пример #9
0
 private void SaveAction()
 {
     IsChanged    = false;
     _model.Name  = _viewModel.Name;
     _model.Order = _viewModel.Order;
     if (_isCreate)
     {
         _model.Id = Guid.NewGuid();
         _repo.CreateZone(_model);
     }
     else
     {
         _repo.EditZone(_model);
     }
     CloseWindow();
     SaveComplete?.Invoke(this, _model);
 }
Пример #10
0
 private void SaveAction()
 {
     IsChanged     = false;
     _model.Name   = _viewModel.Name;
     _model.Number = _viewModel.Number;
     _model.Type   = _viewModel.Type;
     _model.Url    = _viewModel.Url;
     if (_isCreate)
     {
         _model.Id = Guid.NewGuid();
         _repo.CreateItem(_model);
     }
     else
     {
         _repo.EditItem(_model);
     }
     CloseWindow();
     SaveComplete?.Invoke(this, _model);
 }
Пример #11
0
        public async void Save()
        {
            if (Busy)
            {
                return;
            }

            Busy = true;

            if (string.IsNullOrEmpty(FirstName) || string.IsNullOrEmpty(FirstName))
            {
                SaveFailed?.Invoke(this, "First and Last Name are required.");
                Busy = false;
                return;
            }

            if (string.IsNullOrEmpty(Email))
            {
                SaveFailed?.Invoke(this, "Email is required.");
                Busy = false;
                return;
            }

            if (string.IsNullOrEmpty(Address.PlaceId))
            {
                SaveFailed?.Invoke(this, "Address is required.");
                Busy = false;
                return;
            }

            var result = await Services.Host.UserService.UpdateDetails(FirstName, LastName, Email, Address.PlaceId);

            if (result.Error)
            {
                SaveFailed?.Invoke(this, result.Message);
                Busy = false;
            }

            SaveComplete?.Invoke(this, EventArgs.Empty);
            Busy = false;
        }
Пример #12
0
        public virtual void SaveFileAsync(byte[] data, string filename, object taskId)
        {
            AsyncOperation asyncOperation =
                AsyncOperationManager.CreateOperation(taskId);

            lock (HybridDictionary.SyncRoot)
            {
                if (HybridDictionary.Contains(taskId))
                {
                    throw new ArgumentException("TaskID parameter must be unique", "taskID");
                }
            }

            HybridDictionary[taskId] = asyncOperation;

            SaveComplete workerDelegate = new SaveComplete(SaveWorker);

            workerDelegate.BeginInvoke(
                data,
                filename,
                asyncOperation,
                null,
                null);
        }
Пример #13
0
 private void onSaveComplete(List <LocationResultSet> results)
 {
     SaveComplete?.Invoke(results);
 }
Пример #14
0
 private void notifySaveComplete(bool success)
 {
     IsBusy = false;
     SaveComplete?.Invoke(success);
 }
Пример #15
0
 private void onSaveComplete(LocationResultSet result)
 {
     SaveComplete?.Invoke(result);
 }