Ejemplo n.º 1
0
        private void Bind(Project project)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                ButtonRefresh.Enabled = ButtonOptions.Enabled = ButtonSynchronise.Enabled = false;

                if (project != null)
                {
                    _formProgress.Project = project;
                    if (_formProgress.ShowDialog(this) == DialogResult.OK)
                    {
                        Focus();
                        _formProject.Bind(project);
                        ButtonRefresh.Enabled = ButtonOptions.Enabled = ButtonSynchronise.Enabled = true;
                        _formProject.Show();
                    }
                }
                else
                {
                    _formProject.Hide();
                }
            }
            catch (Exception ex)
            {
                Program.HandleException(this, ex, Strings.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        public void Bind(Project project, IList<ModelObject> objects)
        {
            textScript.IsReadOnly = false;
            textScript.Text = project.Driver.GenerateScript(objects);
            textScript.ConfigurationManager.Language = project.Driver.Syntax;
            textScript.ApplySettings();
            textScript.IsReadOnly = true;

            labelHeaderAction.Text = string.Format("Use this script to modify database {0} on server {1} to make it compatible with database {2} on server {3}",
                                                   project.Target.Catalog, project.Target.Host, project.Source.Catalog, project.Source.Host);
        }
Ejemplo n.º 3
0
        public static void SaveProject(Project project)
        {
            if (string.IsNullOrWhiteSpace(project.FilePath))
            {
                project.FilePath = string.Format(@"{0}\{1}-{2} vs {3}-{4}.odbx",
                                                 SavedProjectsFolder,
                                                 project.Source.Host, project.Source.Catalog,
                                                 project.Target.Host, project.Target.Catalog);
            }

            var xmlSerializer = new XmlSerializer(typeof (ProjectDTO));

            using (TextWriter writeFileStream = new StreamWriter(project.FilePath))
            {
                xmlSerializer.Serialize(writeFileStream, new ProjectDTO(project));
                writeFileStream.Close();
            }
        }
Ejemplo n.º 4
0
        public void Bind(Project project)
        {
            Cursor.Current = Cursors.WaitCursor;

            Project = project;

            Text = project.FilePath;
            controlScriptDiff1.Syntax = _project.Driver.Syntax;
            panelDirection.BackgroundImage = Resources.big_arrow_right;

            labelSourceConnection.Text = _project.Source.Host;
            labelTargetConnection.Text = _project.Target.Host;
            labelSourceCatalog.Text = _project.Source.Catalog;
            labelTargetCatalog.Text = _project.Target.Catalog;

            BuildView();
            resultGrid.CollapseAll();

            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 5
0
        private void ButtonEditProjectClick(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                var formProjectConfiguration = new FormProjectConfiguration {Project = SelectedProject};

                if (formProjectConfiguration.ShowDialog(this) == DialogResult.OK)
                {
                    SelectedProject = formProjectConfiguration.Project;
                    DialogResult = DialogResult.OK;
                    Close();
                }
            }
            catch (Exception ex)
            {
                Program.HandleException(this, ex, Strings.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 6
0
        public ProjectDTO(Project project)
        {
            DriverId = project.Driver.Id;
            DriverName = project.Driver.Name;
            Source = project.Source.ConnectionString;
            Target = project.Target.ConnectionString;
            Version = "1.0";
            Author = project.Author;

            Options = new List<ProjectOptionDTO>();
            foreach (DriverOption driverOption in project.Options)
            {
                Options.Add(new ProjectOptionDTO

                                {
                                    Id = driverOption.Id,
                                    Name = driverOption.Name,
                                    Value = driverOption.ConfiguredValue
                                }
                    );
            }
        }
Ejemplo n.º 7
0
        private void FormProjectConfigurationShown(object sender, EventArgs e)
        {
            if (Project == null)
            {
                Project = new Project
                              {
                                  Driver = _drivers.First(),
                                  Target = new Connection {Authentication = AuthenticationMethod.Integrated},
                                  Source = new Connection {Authentication = AuthenticationMethod.Integrated},
                              };
                Project.Options = Project.Driver.Configuration.Options;
                ResetDriverOptions();
            }

            ConnectionBuilderDestination.Configuration = Project.Target;
            ConnectionBuilderDestination.Driver = Project.Driver;

            ConnectionBuilderSource.Configuration = Project.Source;
            ConnectionBuilderSource.Driver = Project.Driver;

            cboDriver.SelectedItem = cboDriver.Items.Cast<IDriver>().First(item => item.Id == Project.Driver.Id);

            BindDriverOptions();
            EvaluateReadiness();
        }
Ejemplo n.º 8
0
 private void ListViewProjectsSelectedIndexChanged(object sender, EventArgs e)
 {
     buttonAccept.Enabled = buttonEditProject.Enabled = (ListViewProjects.SelectedItem != null);
     if (ListViewProjects.SelectedItem == null)
         SelectedProject = null;
     else
         SelectedProject = (Project) ListViewProjects.SelectedItem.RowObject;
 }