Beispiel #1
0
        public override void Execute(object parameter)
        {
            AskUser.QuestionAsync("Save", "Please enter a name").ContinueOnSuccessInTheUIThread(name =>
            {
                var doc = new PatchDocument
                {
                    PatchOnOption = patchModel.PatchOn,
                    Query         = patchModel.QueryDoc.CurrentSnapshot.GetText(LineTerminator.Newline),
                    Script        = patchModel.Script.CurrentSnapshot.GetText(LineTerminator.Newline),
                    SelectedItem  = patchModel.SelectedItem,
                    Id            = "Studio/Patch/" + name,
                    Values        = patchModel.Values.ToList()
                };

                var session = ApplicationModel.Current.Server.Value.DocumentStore.OpenAsyncSession();
                session.Store(doc);
                session.SaveChangesAsync().ContinueOnSuccessInTheUIThread(() => patchModel.UpdateDoc(name));
            });
        }
Beispiel #2
0
		public override void Execute(object parameter)
		{
			AskUser.QuestionAsync("Save", "Please enter a name").ContinueOnSuccessInTheUIThread(name =>
			{
				var doc = new PatchDocument
				{
					PatchOnOption = patchModel.PatchOn,
					Query = patchModel.QueryDoc.CurrentSnapshot.GetText(LineTerminator.Newline),
					Script = patchModel.Script.CurrentSnapshot.GetText(LineTerminator.Newline),
					SelectedItem = patchModel.SelectedItem,
					Id = "Studio/Patch/" + name,
					Values = patchModel.Values.ToList()
				};
				var dbName = ApplicationModel.Database.Value.Name;
				if (dbName == Constants.SystemDatabase)
					dbName = null;

				var session = ApplicationModel.Current.Server.Value.DocumentStore.OpenAsyncSession(dbName);
				session.Store(doc);
				session.SaveChangesAsync().ContinueOnSuccessInTheUIThread(() => patchModel.UpdateDoc(name));
			});
		}