Пример #1
0
        /// <summary>
        /// 在客户端弹出窗口进行数据库升级。
        /// </summary>
        public static void MigrateOnClient()
        {
            bool success = false;
            var control = new DatabaseMigrationControl();
            App.Windows.ShowDialog(control, win =>
            {
                win.Title = "选择要升级的数据库";
                win.Width = 200;
                win.SizeToContent = SizeToContent.Height;
                win.ShowInTaskbar = true;

                win.ValidateOperations += (o, e) =>
                {
                    var options = control.GetSelectionResult();
                    if (!HasDatabase(options)) { e.Cancel = true; }

                    if (RafyEnvironment.Location.IsWPFUI)
                    {
                        if (RafyEnvironment.Location.ConnectDataDirectly)
                        {
                            MigrateDbInProgress(options);
                        }
                        else
                        {
                            MigrateOnServer(options);
                        }
                        success = true;
                    }
                };
            });
            if (success) { App.MessageBox.Show("数据库升级完成。"); }
        }
Пример #2
0
        /// <summary>
        /// 在客户端弹出窗口进行数据库升级。
        /// </summary>
        public static void MigrateOnClient()
        {
            bool success = false;
            var  control = new DatabaseMigrationControl();

            App.Windows.ShowDialog(control, win =>
            {
                win.Title         = "选择要升级的数据库";
                win.Width         = 200;
                win.SizeToContent = SizeToContent.Height;
                win.ShowInTaskbar = true;

                win.ValidateOperations += (o, e) =>
                {
                    var options = control.GetSelectionResult();
                    if (!HasDatabase(options))
                    {
                        e.Cancel = true;
                    }

                    if (RafyEnvironment.Location.IsWPFUI)
                    {
                        if (RafyEnvironment.Location.ConnectDataDirectly)
                        {
                            MigrateDbInProgress(options);
                        }
                        else
                        {
                            MigrateOnServer(options);
                        }
                        success = true;
                    }
                };
            });
            if (success)
            {
                App.MessageBox.Show("数据库升级完成。");
            }
        }