Пример #1
0
        public static void Run(IDatabaseSource src, IDatabaseSource dst, SynchronizeExtData extData)
        {
            if (!LicenseTool.FeatureAllowedMsg(DbStructSynchronizationFeature.Test))
            {
                return;
            }
            SynchronizeStructureForm win = new SynchronizeStructureForm(src, dst, extData);

            win.Show();
        }
Пример #2
0
        public SynchronizeStructureForm(IDatabaseSource src, IDatabaseSource dst, SynchronizeExtData extInfo)
        {
            m_synExtData = extInfo;
            InitializeComponent();
            m_imgCache = new ImageCache(imageList1, Color.White);
            //btnUncheckAll.Image = ImageTool.CombineImages(CoreIcons.check, CoreIcons.delete_overlay);
            ConnPack.Cache = new CachePack
            {
                ReuseAnalyserCache = true
            };
            //m_srcData = new TreeStructureData(treeSource, Color.Green, this, src, true);
            //m_dstData = new TreeStructureData(treeTarget, Color.Red, this, dst, false);
            //m_srcData.OtherTree = m_dstData;
            //m_dstData.OtherTree = m_srcData;
            Disposed += new EventHandler(SynchronizeStructureForm_Disposed);
            m_srcDb   = src;
            m_dstDb   = dst;
            if (m_srcDb != null)
            {
                m_srcDb.ChangeConnection(ConnPack);
            }
            if (m_dstDb != null)
            {
                m_dstDb.ChangeConnection(ConnPack);
            }
            //m_invoker = new ControlInvoker(this);
            m_settings = new SynchronizeSettings();
            SettingsTool.CopySettingsPage((SynchronizeSettings)GlobalSettings.Pages.PageByName("synchronize"), m_settings);
            //m_trace = new TraceVisibilityHandler(btnTrace);

            UpdateTitles();
            DownloadWhenNeededAndRefresh();

            colObjectType.ImageGetter         = row => ((DbDiffAction)row).GetObjectTypeImage(m_imgCache);
            colRelation.ImageGetter           = row => ((DbDiffAction)row).GetRelationImage(m_imgCache);
            colColumnRelation.ImageGetter     = row => ((DbDiffAction)row).GetRelationImage(m_imgCache);
            colConstraintRelation.ImageGetter = row => ((DbDiffAction)row).GetRelationImage(m_imgCache);
            colConstraintType.ImageGetter     = row => ((DbDiffAction)row).GetObjectTypeImage(m_imgCache);
            colObjType.ImageGetter            = row => ((DbDiffAction)row).GetObjectTypeImage(m_imgCache);

            if (extInfo != null && extInfo.Dbs != null)
            {
                FillDbs(btnSelectSourceDb, cbxSelectSource);
                if (extInfo.SelectedSource != null)
                {
                    cbxSelectSource.SelectedIndex = cbxSelectSource.Items.IndexOf(extInfo.SelectedSource);
                }

                FillDbs(btnSelectTargetDb, cbxSelectTarget);
                if (extInfo.SelectedTarget != null)
                {
                    cbxSelectTarget.SelectedIndex = cbxSelectTarget.Items.IndexOf(extInfo.SelectedTarget);
                }
            }
            else
            {
                cbxSelectSource.Visible = false;
                cbxSelectTarget.Visible = false;
            }

            m_initialized = true;
        }