public void OnFocus()
        {
            // Display the contents of the current SyncScope for review
            this.displayBox.Text = "Running SyncSvcUtil command...\n";
            var tArgs = new List <String>();

            tArgs.Add("/scopeconfig:" + WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.CONFIG_FILE_NAME]);
            tArgs.Add("/mode:" + WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_PROV_MODE]);
            tArgs.Add("/scopename:" + WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_CONFIG_NAME]);

            try
            {
                this.displayBox.Text += "Command line :" + Environment.NewLine;
                this.displayBox.Text += " --------------------------------------------- " + Environment.NewLine;
                this.displayBox.Text += tArgs.Aggregate("syncsvcutil.exe ", (current, tArg) => current + tArg + " ") + Environment.NewLine;
                this.displayBox.Text += " --------------------------------------------- " + Environment.NewLine;
                this.displayBox.Text += Environment.NewLine;

                SyncSvcUtil.LogOccured += SyncSvcUtilOnLogOccured;
                SyncSvcUtil.Main(tArgs.ToArray());
            }
            catch (Exception ex)
            {
                this.displayBox.Text += ex.Message;
            }



            //this.displayBox.Text += WizardHelper.ExecuteProcessAndReturnLog(
            //    string.Format(WizardHelper.PROV_PARAM_FORMAT,
            //                  "\"" + WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.CONFIG_FILE_NAME] + "\"",
            //                  WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_PROV_MODE],
            //                  WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_CONFIG_NAME],
            //                  WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_DB_NAME]));
        }
예제 #2
0
        public void OnFocus()
        {
            //string sourceSpecificParams = null;
            //string commonParams = null;

            SyncSvcUtil.LogOccured += SyncSvcUtilOnLogOccured;

            var tArgs = new List <String>();


            if (WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_CODEGEN_SOURCE] ==
                WizardHelper.CONFIG_FILE_CODEGEN_SOURCE)
            {
                // Display the contents of the current SyncScope for review
                this.displayBox.Text = "Running SyncSvcUtil command...\n";

                tArgs.Add("/scopeconfig:" + WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CONFIG_FILE_NAME]);
                tArgs.Add("/scopename:" + WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_CONFIG_NAME]);
                tArgs.Add("/database:" + WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_DB_NAME]);

                //sourceSpecificParams = string.Format(WizardHelper.CONFIG_CODEGEN_PARAM_FORMAT,
                //                  WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CONFIG_FILE_NAME],
                //                  WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_CONFIG_NAME],
                //                  WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_DB_NAME]);
            }
            //else
            //{
            //    sourceSpecificParams = string.Format(WizardHelper.CSDL_CODEGEN_PARAM_FORMAT,
            //                      WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CSDL_CODEGEN_URL],
            //                      WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_CONFIG_NAME]);
            //}

            tArgs.Add("/language:" + WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_LANGUAGE]);
            tArgs.Add("/namespace:" + WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_NAMESPACE]);
            tArgs.Add("/mode:codegen");
            tArgs.Add("/target:" + WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_TARGET]);
            tArgs.Add("/directory:" + WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_OUTDIRECTORY]);


            //commonParams = string.Format(WizardHelper.CODEGEN_COMMON_PARAMS_FORMAT,
            //                  WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_LANGUAGE],
            //                  WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_NAMESPACE],
            //                  WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_TARGET],
            //                  WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_OUTDIRECTORY]);

            if (!string.IsNullOrEmpty(WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_OUTPREFIX]))
            {
                tArgs.Add("/outprefix:" + WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_OUTPREFIX]);

                //commonParams = string.Format(WizardHelper.CODEGEN_OUTPREFIX_PARAM_FORMAT,
                //    commonParams,
                //    WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_OUTPREFIX]);
            }

            this.displayBox.Text += "Command line :" + Environment.NewLine;
            this.displayBox.Text += " --------------------------------------------- " + Environment.NewLine;
            this.displayBox.Text += tArgs.Aggregate("syncsvcutil.exe ", (current, tArg) => current + tArg + " ") + Environment.NewLine;
            this.displayBox.Text += " --------------------------------------------- " + Environment.NewLine;
            this.displayBox.Text += Environment.NewLine;


            SyncSvcUtil.Main(tArgs.ToArray());

            // this.displayBox.Text += WizardHelper.ExecuteProcessAndReturnLog(sourceSpecificParams + commonParams);
        }