예제 #1
0
파일: MainForm.cs 프로젝트: LudovicT/NShape
 private void toolBox_ShowLibraryManagerDialog(object sender, EventArgs e)
 {
     LibraryManagementDialog dlg = new LibraryManagementDialog(project);
 }
예제 #2
0
파일: MainForm.cs 프로젝트: LudovicT/NShape
 private void toolSetController1_LibraryManagerSelected(object sender, EventArgs e)
 {
     using (LibraryManagementDialog dlg = new LibraryManagementDialog(project))
         dlg.ShowDialog(this);
 }
예제 #3
0
		private void CheckLibrariesLoaded() {
			bool librariesLoaded = false;
			foreach (System.Reflection.Assembly a in project.Libraries) {
				librariesLoaded = true;
				break;
			}
			if (!librariesLoaded) {
				if (MessageBox.Show(this, "Do you want to load shape libraries now?", "Load shape libraries",
					MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) {
					using (LibraryManagementDialog dlg = new LibraryManagementDialog(project))
						dlg.ShowDialog(this);
				}
			}
		}
예제 #4
0
		private void adoNetDatabaseGeneratorToolStripMenuItem_Click(object sender, EventArgs e) {
			if (project.Repository == null)
				MessageBox.Show(this, "No repository set.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			else if (!(project.Repository is CachedRepository))
				MessageBox.Show(this, string.Format("Repositories of type '{0}' are not supported by the database generator.", project.Repository.GetType().Name), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			else {
				if (project.IsOpen) {
					string msgStr = "You are about to create a new database schema for a NShape database repository." + Environment.NewLine + Environment.NewLine;
					msgStr += "If you proceed, the current project will be closed and you will be asked for a database server and for choosing a set of NShape libraries." + Environment.NewLine;
					msgStr += "You can not save projects in the database using other than the selected libraries." + Environment.NewLine + Environment.NewLine;
					msgStr += "Do you want to proceed?";
					DialogResult result = MessageBox.Show(this, msgStr, "Create ADO.NET database schema", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
					if (result != DialogResult.Yes) return;
					if (!CloseProject()) return;
				}
				AdoNetStore store = GetAdoNetStore();
				if (store != null) {
					CachedRepository cachedReporitory = (CachedRepository)project.Repository;
					cachedReporitory.Store = store;
					project.RemoveAllLibraries();
					using (LibraryManagementDialog dlg = new LibraryManagementDialog(project))
						dlg.ShowDialog(this);
					project.RegisterEntityTypes();

					Cursor = Cursors.WaitCursor;
					Application.DoEvents();
					try {
						store.DropDbSchema();
						store.CreateDbCommands(cachedReporitory);
						store.CreateDbSchema(cachedReporitory);
						project.Close();
						MessageBox.Show(this, "Database schema created successfully.", "Schema created", MessageBoxButtons.OK, MessageBoxIcon.Information);
					} catch (Exception exc) {
						MessageBox.Show(this, "An error occured while creating database schema:" + Environment.NewLine + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
					} finally {
						Cursor = Cursors.Default;
					}
				}
			}
		}
예제 #5
0
		private void ManageShapeAndModelLibrariesMenuItem_Click(object sender, EventArgs e) {
			using (LibraryManagementDialog dlg = new LibraryManagementDialog(project))
				dlg.ShowDialog(this);
		}
예제 #6
0
		private void toolBoxAdapter_ShowLibraryManagerDialog(object sender, EventArgs e) {
			LibraryManagementDialog dlg = new LibraryManagementDialog(project);
			dlg.Show(this);
		}