Beispiel #1
0
        public static void DataSyncSettingClick(IocManager iocManager, IFormIOSchemeManager formIOSchemeManager, IDataSyncSettingsManager dataSyncSettingManager, ILogger logger)
        {
            DialogHybirdForm <FormIOControl> dialog = new DialogHybirdForm <FormIOControl>(iocManager, typeof(ZtgeoGisHybridMoudle).Assembly, new string[] {
                "WebViews", "FormIO", "FormIoWebView.html"
            });

            dialog.Size            = new Size(1260, 760);
            dialog.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            dialog.StartPosition   = FormStartPosition.CenterScreen;
            string component = formIOSchemeManager.GetFormIOSchemeById(1);
            string data      = dataSyncSettingManager.GetDataSyncSettings();

            ((FormIOControl)dialog.hybridControl).SetFormIOComponentAndData(component, data);
            ((FormIOControl)dialog.hybridControl).OnSave = (control, submissionData) => {
                try
                {
                    dynamic subdata = JsonConvert.DeserializeObject <dynamic>(submissionData);
                    dataSyncSettingManager.SetDataSyncSettings(subdata);
                }
                catch (Exception ex) {
                    EventBus.Default.Trigger(new NonUIExceptionEventData {
                        UnhandledExceptionEventArgs = new UnhandledExceptionEventArgs(ex, false)
                    });
                }
            };
            dialog.ShowDialog();
        }
Beispiel #2
0
        public static void ShowDialog(IocManager iocManager, IFormIOSchemeManager formIOSchemeManager, ILoginManager loginManager)
        {
            DialogHybirdForm <FormIOControl> dialog = new DialogHybirdForm <FormIOControl>(iocManager, typeof(ZtgeoGisHybridMoudle).Assembly, new string[] {
                "WebViews", "FormIO", "FormIoWebView.html"
            });

            dialog.Size          = new Size(550, 520);
            dialog.MaximizeBox   = false;
            dialog.MinimizeBox   = false;
            dialog.StartPosition = FormStartPosition.CenterScreen;
            dialog.ShowIcon      = true;
            dialog.Icon          = new Icon(AssemblyResource.GetResourceStream(typeof(ZtgeoGISDesktopMoudle).Assembly, "ZtgeoGISDesktop.Icons.login.ico"));
            string component = formIOSchemeManager.GetFormIOSchemeById(2);

            ((FormIOControl)dialog.hybridControl).SetFormIOComponentAndData(component, "{}");
            ((FormIOControl)dialog.hybridControl).OnSave = (control, submissionData) => {
                try
                {
                    dynamic subdata = JsonConvert.DeserializeObject <dynamic>(submissionData);
                    var     authenticateResultModel = loginManager.Login(new Ztgeo.Gis.Runtime.Authorization.AuthenticateModel {
                        UserNameOrEmailAddress = subdata.data.UserName, Password = subdata.data.Password
                    }, (bool)subdata.data.IsServerless);

                    if (authenticateResultModel != null && authenticateResultModel.ShouldResetPassword)
                    {
                        MessageBox.Show("密码需要重置,请联系管理员");
                        return;
                    }
                    if (authenticateResultModel != null)
                    {
                        dialog.DialogResult = DialogResult.OK;
                        dialog.Close();
                    }
                }
                catch (Exception ex)
                {
                    EventBus.Default.Trigger(new NonUIExceptionEventData {
                        UnhandledExceptionEventArgs = new UnhandledExceptionEventArgs(ex, false)
                    });
                }
            };
            if (dialog.ShowDialog() == DialogResult.Cancel)
            {
                System.Environment.Exit(0);
            }
        }