예제 #1
0
        private void AddAction()
        {
            if (ActionsTabs.SelectedContent != null && ((ucGrid)ActionsTabs.SelectedContent).CurrentItem != null)
            {
                if (((Act)(((ucGrid)ActionsTabs.SelectedContent).CurrentItem)).AddActionWizardPage != null)
                {
                    _pageGenericWin.Close();
                    string classname = ((Act)(((ucGrid)ActionsTabs.SelectedContent).CurrentItem)).AddActionWizardPage;
                    Type   t         = Assembly.GetExecutingAssembly().GetType(classname);
                    if (t == null)
                    {
                        throw new Exception("Action edit page not found - " + classname);
                    }

                    WizardBase wizard = (GingerWPF.WizardLib.WizardBase)Activator.CreateInstance(t);
                    WizardWindow.ShowWizard(wizard);
                }
                else
                {
                    Act aNew = null;

                    if (ActionsTabs.SelectedContent != null && ((ucGrid)ActionsTabs.SelectedContent).CurrentItem != null)
                    {
                        aNew = (Act)(((Act)(((ucGrid)ActionsTabs.SelectedContent).CurrentItem)).CreateCopy());
                    }
                    else
                    {
                        Reporter.ToUser(eUserMsgKeys.NoItemWasSelected);
                        return;
                    }
                    aNew.SolutionFolder = App.UserProfile.Solution.Folder.ToUpper();

                    //adding the new act after the selected action in the grid
                    //TODO: Add should be after the last, Insert should be in the middle...



                    int selectedActIndex = -1;
                    if (mActionsList.CurrentItem != null)
                    {
                        selectedActIndex = mActionsList.IndexOf((Act)mActionsList.CurrentItem);
                    }
                    mActionsList.Add(aNew);
                    if (selectedActIndex >= 0)
                    {
                        mActionsList.Move(mActionsList.Count - 1, selectedActIndex + 1);
                    }

                    _pageGenericWin.Close();

                    //allowing to edit the action
                    ActionEditPage actedit = new ActionEditPage(aNew);
                    actedit.ShowAsWindow();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// In case object of type Act was passed, adds relevant action being Legacy/PlugIn/One that Adds via Wizard
        /// </summary>
        /// <param name="selectedAction"></param>
        /// <param name="mContext"></param>
        /// <returns></returns>
        static Act GenerateSelectedAction(Act selectedAction, Context mContext)
        {
            if (selectedAction.AddActionWizardPage != null)
            {
                string classname = selectedAction.AddActionWizardPage;
                Type   t         = System.Reflection.Assembly.GetExecutingAssembly().GetType(classname);
                if (t == null)
                {
                    throw new Exception("Action edit page not found - " + classname);
                }

                WizardBase wizard = (WizardBase)Activator.CreateInstance(t, mContext);
                WizardWindow.ShowWizard(wizard);

                return(null);
            }
            else
            {
                Act instance = null;

                if (selectedAction.IsSharedRepositoryInstance || selectedAction.ContainingFolder.Contains("SharedRepository"))
                {
                    instance = (Act)selectedAction.CreateInstance(true);
                }
                else
                {
                    instance = (Act)selectedAction.CreateCopy();
                }

                if (selectedAction is IObsoleteAction && (selectedAction as IObsoleteAction).IsObsoleteForPlatform(mContext.Platform))
                {
                    eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.WarnAddLegacyActionAndOfferNew, ((IObsoleteAction)selectedAction).TargetActionTypeName());
                    if (userSelection == eUserMsgSelection.Yes)
                    {
                        instance             = ((IObsoleteAction)selectedAction).GetNewAction();
                        instance.Description = instance.ActionType;
                    }
                    else if (userSelection == eUserMsgSelection.Cancel)
                    {
                        return(null);            //do not add any action
                    }
                }

                for (int i = 0; i < selectedAction.InputValues.Count; i++)
                {
                    instance.InputValues[i].ParamTypeEX = selectedAction.InputValues[i].ParamTypeEX;
                }

                instance.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();

                if (instance is ActPlugIn)
                {
                    ActPlugIn p = (ActPlugIn)instance;
                    // TODO: add per group or... !!!!!!!!!

                    //Check if target already exist else add it
                    // TODO: search only in targetplugin type
                    TargetPlugin targetPlugin = (TargetPlugin)(from x in mContext.BusinessFlow.TargetApplications where x.Name == p.ServiceId select x).SingleOrDefault();
                    if (targetPlugin == null)
                    {
                        // check if interface add it
                        // App.BusinessFlow.TargetApplications.Add(new TargetPlugin() { AppName = p.ServiceId });

                        mContext.BusinessFlow.TargetApplications.Add(new TargetPlugin()
                        {
                            PluginId = p.PluginId, ServiceId = p.ServiceId
                        });

                        //Search for default agent which match
                        mContext.Runner.UpdateApplicationAgents();
                        // TODO: update automate page target/agent

                        // if agent not found auto add or ask user
                    }
                }

                return(instance);
            }
        }
예제 #3
0
        private void AddAction()
        {
            if (ActionsTabs.SelectedContent != null && ((ucGrid)ActionsTabs.SelectedContent).CurrentItem != null)
            {
                if (((Act)(((ucGrid)ActionsTabs.SelectedContent).CurrentItem)).AddActionWizardPage != null)
                {
                    _pageGenericWin.Close();
                    string classname = ((Act)(((ucGrid)ActionsTabs.SelectedContent).CurrentItem)).AddActionWizardPage;
                    Type   t         = Assembly.GetExecutingAssembly().GetType(classname);
                    if (t == null)
                    {
                        throw new Exception("Action edit page not found - " + classname);
                    }

                    WizardBase wizard = (GingerWPF.WizardLib.WizardBase)Activator.CreateInstance(t);
                    WizardWindow.ShowWizard(wizard);
                }
                else
                {
                    Act aNew = null;

                    if (ActionsTabs.SelectedContent != null && ((ucGrid)ActionsTabs.SelectedContent).CurrentItem != null)
                    {
                        Act selectedAction = (Act)(((ucGrid)ActionsTabs.SelectedContent).CurrentItem);
                        aNew = (Act)selectedAction.CreateCopy();
                        // copy param ex info
                        for (int i = 0; i < selectedAction.InputValues.Count; i++)
                        {
                            aNew.InputValues[i].ParamTypeEX = selectedAction.InputValues[i].ParamTypeEX;
                        }
                    }
                    else
                    {
                        Reporter.ToUser(eUserMsgKeys.NoItemWasSelected);
                        return;
                    }
                    aNew.SolutionFolder = App.UserProfile.Solution.Folder.ToUpper();

                    //adding the new act after the selected action in the grid
                    //TODO: Add should be after the last, Insert should be in the middle...



                    int selectedActIndex = -1;
                    if (mActionsList.CurrentItem != null)
                    {
                        selectedActIndex = mActionsList.IndexOf((Act)mActionsList.CurrentItem);
                    }
                    mActionsList.Add(aNew);
                    if (selectedActIndex >= 0)
                    {
                        mActionsList.Move(mActionsList.Count - 1, selectedActIndex + 1);
                    }

                    _pageGenericWin.Close();

                    //allowing to edit the action
                    ActionEditPage actedit = new ActionEditPage(aNew);
                    actedit.ShowAsWindow();

                    if (aNew is ActPlugIn)
                    {
                        ActPlugIn p = (ActPlugIn)aNew;
                        // TODO: add per group or... !!!!!!!!!

                        //Check if target already exist else add it
                        // TODO: search only in targetplugin type
                        TargetPlugin targetPlugin = (TargetPlugin)(from x in App.BusinessFlow.TargetApplications where x.Name == p.ServiceId select x).SingleOrDefault();
                        if (targetPlugin == null)
                        {
                            // check if interface add it
                            // App.BusinessFlow.TargetApplications.Add(new TargetPlugin() { AppName = p.ServiceId });

                            App.BusinessFlow.TargetApplications.Add(new TargetPlugin()
                            {
                                PluginId = p.PluginId, ServiceId = p.ServiceId
                            });

                            //Search for default agent which match
                            App.AutomateTabGingerRunner.UpdateApplicationAgents();
                            // TODO: update automate page target/agent

                            // if agent not found auto add or ask user
                        }
                    }
                }
            }
        }
예제 #4
0
        private void AddAction()
        {
            if (ActionsTabs.SelectedContent != null && ((ucGrid)ActionsTabs.SelectedContent).CurrentItem != null)
            {
                Act selectedAction = (Act)(((ucGrid)ActionsTabs.SelectedContent).CurrentItem);

                //warn regarding Leagacy Actions
                if (LegacyActionsTab.IsSelected)
                {
                    if (selectedAction is IObsoleteAction)
                    {
                        eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.WarnAddLegacyActionAndOfferNew, ((IObsoleteAction)selectedAction).TargetActionTypeName());
                        if (userSelection == eUserMsgSelection.Yes)
                        {
                            selectedAction = ((IObsoleteAction)selectedAction).GetNewAction();
                        }
                        else if (userSelection == eUserMsgSelection.Cancel)
                        {
                            return;//do not add any action
                        }
                    }
                    else
                    {
                        if (Reporter.ToUser(eUserMsgKey.WarnAddLegacyAction) == eUserMsgSelection.No)
                        {
                            return;//do not add any action
                        }
                    }
                }

                if (selectedAction.AddActionWizardPage != null)
                {
                    _pageGenericWin.Close();
                    string classname = selectedAction.AddActionWizardPage;
                    Type   t         = Assembly.GetExecutingAssembly().GetType(classname);
                    if (t == null)
                    {
                        throw new Exception("Action edit page not found - " + classname);
                    }

                    WizardBase wizard = (GingerWPF.WizardLib.WizardBase)Activator.CreateInstance(t, mContext);
                    WizardWindow.ShowWizard(wizard);
                }
                else
                {
                    Act newAction = null;
                    newAction         = (Act)selectedAction.CreateCopy();
                    newAction.Context = mContext;
                    // copy param ex info
                    for (int i = 0; i < selectedAction.InputValues.Count; i++)
                    {
                        newAction.InputValues[i].ParamTypeEX = selectedAction.InputValues[i].ParamTypeEX;
                    }

                    newAction.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();

                    //adding the new act after the selected action in the grid
                    //TODO: Add should be after the last, Insert should be in the middle...
                    int selectedActIndex = -1;
                    if (mActionsList.CurrentItem != null)
                    {
                        selectedActIndex = mActionsList.IndexOf((IAct)mActionsList.CurrentItem);
                    }
                    mActionsList.Add(newAction);
                    if (selectedActIndex >= 0)
                    {
                        mActionsList.Move(mActionsList.Count - 1, selectedActIndex + 1);
                    }

                    _pageGenericWin.Close();

                    //allowing to edit the action
                    ActionEditPage actedit = new ActionEditPage(newAction);
                    actedit.ShowAsWindow();

                    if (newAction is ActPlugIn)
                    {
                        ActPlugIn p = (ActPlugIn)newAction;
                        // TODO: add per group or... !!!!!!!!!

                        //Check if target already exist else add it
                        // TODO: search only in targetplugin type
                        TargetPlugin targetPlugin = (TargetPlugin)(from x in mBusinessFlow.TargetApplications where x.Name == p.ServiceId select x).SingleOrDefault();
                        if (targetPlugin == null)
                        {
                            // check if interface add it
                            // App.BusinessFlow.TargetApplications.Add(new TargetPlugin() { AppName = p.ServiceId });

                            mBusinessFlow.TargetApplications.Add(new TargetPlugin()
                            {
                                PluginId = p.PluginId, ServiceId = p.ServiceId
                            });

                            //Search for default agent which match
                            mContext.Runner.UpdateApplicationAgents();
                            // TODO: update automate page target/agent

                            // if agent not found auto add or ask user
                        }
                    }
                }
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.NoItemWasSelected);
                return;
            }
        }
예제 #5
0
        private void wizardControl1_NextButtonClick(WizardBase.WizardControl sender, WizardBase.WizardNextButtonClickEventArgs args)
        {
            switch ((WizardStep)this.wizardControl1.CurrentStepIndex)
            {
                case WizardStep.Start:
                    switch (this.ConversionType)
                    {
                        case Conversion.ResXToXls:
                            args.NextStepIndex = (int)WizardStep.ResX1;
                            break;
                        case Conversion.XlsToResx:
                            args.NextStepIndex = (int)WizardStep.Xls1;
                            break;
                        default:
                            throw new InvalidOperationException("Unknown conversion");
                    }
                    break;

                case WizardStep.ResX1:
                    if (!Directory.Exists(this.textBoxFolder.Text))
                    {
                        MessageBox.Show(
                            this,
                            "Select an existing project directory to continue",
                            "Project directory",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation);
                        args.Cancel = true;
                    }
                    else
                    {
                        AppSettings.Default.FolderPath = this.textBoxFolder.Text;
                        AppSettings.Default.ScreenshotPath = this.textBoxScreenshots.Text;
                        AppSettings.Default.ScanSubfolders = this.checkBoxSubFolders.Checked;
                    }
                    break;

                case WizardStep.ResX2:
                    if (this.listBoxCulturesSelected.Items.Count == 0)
                    {
                        MessageBox.Show(
                            this,
                            "Please select at least one target culture",
                            "Target culture",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation);
                        args.Cancel = true;
                    }
                    else
                    {
                        var cultures = this.listBoxCulturesSelected.Items.Cast<CultureInfo>()
                                                                         .Select(c => c.Name)
                                                                         .ToArray();
                        AppSettings.Default.CultureList = string.Join(";", cultures);
                    }
                    break;

                case WizardStep.ResX3:
                    AppSettings.Default.ExcludeKeys = StringHelper.ToCollection(this.textBox_ExcludeKey.Text);
                    AppSettings.Default.ExcludeComments = StringHelper.ToCollection(this.textBox_ExcludeComment.Text);
                    AppSettings.Default.ExcludeFilenames = StringHelper.ToCollection(this.textBox_ExcludeFilename.Text);

                    AppSettings.Default.HideKeys = this.hideKeyColumnCheckbox.Checked;
                    AppSettings.Default.HideComments = this.hideCommentColumnCheckbox.Checked;
                    AppSettings.Default.PurgeNonexistant = this.purgeTranslation_CheckBox.Checked;

                    args.NextStepIndex = (int)WizardStep.Finish;
                    this.textBoxSummary.Text = ResX.summary_create_excel + Environment.NewLine;
                    break;

                case WizardStep.Xls1:
                    if (File.Exists(this.textBoxXls.Text))
                    {
                        this.textBoxSummary.Text = ResX.summary_create_resx + Environment.NewLine;
                    }
                    else
                    {
                        MessageBox.Show(
                            this,
                            "Select an existing Excel document to continue",
                            "Excel path",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation);

                        args.Cancel = true;
                    }
                    break;
            }
        }
예제 #6
0
        private void wizardControl1_BackButtonClick(WizardBase.WizardControl sender, WizardBase.WizardClickEventArgs args)
        {
            switch ((WizardStep)this.wizardControl1.CurrentStepIndex)
            {
                case WizardStep.Finish:

                    switch (ConversionType)
                    {
                        case Conversion.ResXToXls:
                            this.wizardControl1.CurrentStepIndex = (int)WizardStep.ResX3;
                            args.Cancel = true;
                            break;
                        default:
                            break;
                    }
                    break;
                case WizardStep.Xls1:

                    switch (ConversionType)
                    {
                        case Conversion.XlsToResx:
                            this.wizardControl1.CurrentStepIndex = (int)WizardStep.Start;
                            args.Cancel = true;
                            break;
                        default:
                            break;

                    }
                    break;
            }
        }
예제 #7
0
        void wizardControl1_NextButtonClick(WizardBase.WizardControl sender, WizardBase.WizardNextButtonClickEventArgs args)
        {
            switch (wizardControl1.CurrentStepIndex)
            {
                case f_ciSITE_DETAILS_STEP_INDEX:
                    Cursor = Cursors.WaitCursor;
                    if (validateUserParams(f_ciSITE_DETAILS_STEP_INDEX))
                    {
                        if (rdoExport.Checked)
                        {
                            f_action = WizardAction.Export;

                            m_bindingMsgForm.Show(this);
                            m_bindingMsgForm.Refresh();

                            // bind treeview..
                            using (SPSite exportSite = new SPSite(f_sSiteUrl))
                            {
                                doSiteTreeBind(exportSite);
                            }

                            OnSiteBindComplete();
                            if (f_exportSettings != null)
                            {
                                addSavedExportItemsToExportListView(f_exportSettings);
                            }
                            args.NextStepIndex = f_ciEXPORT_SELECT_STEP_INDEX;
                        }
                        else
                        {
                            f_action = WizardAction.Import;
                            args.NextStepIndex = f_ciIMPORT_STEP_INDEX;
                        }
                    }
                    else
                    {
                        args.Cancel = true;
                    }
                    Cursor = Cursors.Default;
                    break;
                case f_ciIMPORT_STEP_INDEX:
                    if (validateUserParams(f_ciIMPORT_STEP_INDEX))
                    {
                        args.NextStepIndex = f_ciFINISH_STEP_INDEX;
                    }
                    else
                    {
                        args.Cancel = true;
                    }
                    break;
                case f_ciEXPORT_SELECT_STEP_INDEX:
                    if (validateUserParams(f_ciEXPORT_SELECT_STEP_INDEX))
                    {
                        args.NextStepIndex = f_ciEXPORT_SETTINGS_STEP_INDEX;
                    }
                    else
                    {
                        args.Cancel = true;
                    }
                    break;
                case f_ciEXPORT_SETTINGS_STEP_INDEX:
                    // clear down saved settings from file in case user uses back button..
                    f_exportSettings = null;
                    if (validateUserParams(f_ciEXPORT_SETTINGS_STEP_INDEX))
                    {
                        args.NextStepIndex = f_ciFINISH_STEP_INDEX;
                    }
                    else
                    {
                        args.Cancel = true;
                    }
                    break;
                default:
                    break;
            }
        }