Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            this.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var window = new WizardWindow(ExampleWizard.Wizard);
            window.ShowDialog();
            var window3 = new WizardWindow(
                new Wizard() { Title = "Test",
                    Pages = new List<WizardPage>{new WizardPage{Header="Test", InputFields=new WizardInputField[]{
                        new WizardFieldDescription{Description = "Test *bold*" },
                    new TextWizardInputField{Text="Value"}}}}});
            window3.ShowDialog();
        }
Beispiel #2
0
        private void ReLearnClicked(object sender, RoutedEventArgs e)
        {
            if (mWinExplorer == null)
            {
                Reporter.ToUser(eUserMsgKey.POMAgentIsNotRunning);
                return;
            }

            if (mAgent.Driver.IsDriverBusy)
            {
                Reporter.ToUser(eUserMsgKey.POMDriverIsBusy);
                return;
            }


            WizardWindow.ShowWizard(new PomDeltaWizard(mPOM, mAgent), 1600, 800, true);
        }
Beispiel #3
0
        private void ActionsConversionHandler(object sender, System.Windows.RoutedEventArgs e)
        {
            ObservableList <BusinessFlow> lst = new ObservableList <BusinessFlow>();

            if (((ITreeViewItem)this).NodeObject().GetType().Equals(typeof(GingerCore.BusinessFlow)))
            {
                lst.Add((GingerCore.BusinessFlow)((ITreeViewItem)this).NodeObject());
            }
            else
            {
                var items = ((Amdocs.Ginger.Repository.RepositoryFolder <GingerCore.BusinessFlow>)((ITreeViewItem)this).NodeObject()).GetFolderItemsRecursive();
                foreach (var bf in items)
                {
                    lst.Add(bf);
                }
            }

            WizardWindow.ShowWizard(new ActionsConversionWizard(ActionsConversionWizard.eActionConversionType.MultipleBusinessFlow, new Context(), lst), 900, 700, true);
        }
Beispiel #4
0
        void contexMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            var item = e.ClickedItem;

            if (item.Text == "Open...")
            {
                MainWindow = new WizardWindow();
                MainWindow.Show();
            }
            else if (item.Text == "Send Log Files...")
            {
                var sendLogWindow = new SendLogWindow();
                sendLogWindow.Show();
            }
            else if (item.Text == "Exit")
            {
                Current.Shutdown();
            }
        }
        public WizardContext ShowWizard(AbstractController controller, out string message)
        {
            message = string.Empty;

            if (_action == Enumerators.Action.None)
            {
                message = PluginResources.WizardMessage_NoActionSelected;
                return(null);
            }

            var success = CreateWizardContext(controller, out message);

            if (!success)
            {
                return(null);
            }

            var documents = _controllers.EditorController.GetDocuments();

            if (documents.Any())
            {
                message = PluginResources.WizardMessage_CloseOpenDocumentsInTheEditor;
                return(null);
            }


            _isCancelled          = false;
            _wizardWindow         = new WizardWindow();
            _wizardWindow.Loaded += WizardWindowLoaded;
            _wizardWindow.ShowDialog();

            if (!_isCancelled && _wizardContext.Completed)
            {
                if (_action == Enumerators.Action.Import)
                {
                    _controllers.ProjectsController.RefreshProjects();
                }

                return(_wizardContext);
            }

            return(null);
        }
        private void grdVariables_ItemDropped(object sender, EventArgs e)
        {
            VariableBase dragedItem = (VariableBase)((DragInfo)sender).Data;

            if (dragedItem != null)
            {
                WizardWindow.ShowWizard(new UploadItemToRepositoryWizard(mContext, dragedItem));

                //refresh and select the item
                try
                {
                    VariableBase dragedItemInGrid = ((IEnumerable <VariableBase>)xVariablesGrid.DataSourceList).Where(x => x.Guid == dragedItem.Guid).FirstOrDefault();
                    if (dragedItemInGrid != null)
                    {
                        xVariablesGrid.Grid.SelectedItem = dragedItemInGrid;
                    }
                }
                catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); }
            }
        }
Beispiel #7
0
        public void RunStarted(
            object automationObject,
            Dictionary<string, string> replacementsDictionary,
            WizardRunKind runKind,
            object[] customParams)
        {
            Validate(ProjectNameToken, TryValidateProjectName, replacementsDictionary);
            Validate(ProjectSolutionDirectory, TryValidateSolutionDirectory, replacementsDictionary);

            var mainWindow = new WizardWindow(_wizard);
            var result = mainWindow.ShowDialog();
            if (result.HasValue && result.Value) {
                foreach (var page in _wizard.Pages)
                    foreach (var inputField in page.InputFields)
                        inputField.AddValue(replacementsDictionary);
            }

            // otherwise, cancel.
            throw new WizardCancelledException();
        }
Beispiel #8
0
        private void AddSelectedToSRHandler(object sender, RoutedEventArgs e)
        {
            List <RepositoryItemBase> list = new List <RepositoryItemBase>();
            List <object>             SelectedItemsList = ListView.List.SelectedItems.Cast <object>().ToList();

            foreach (Act act in SelectedItemsList)
            {
                list.Add(act);
                //get target application for the action
                if (mAction is ActWithoutDriver)
                {
                    mAction.Platform = ePlatformType.NA;
                }
                else
                {
                    mAction.Platform = (from x in WorkSpace.Instance.Solution.ApplicationPlatforms where x.AppName == mContext.Activity.TargetApplication select x.Platform).FirstOrDefault();
                }
            }
            WizardWindow.ShowWizard(new UploadItemToRepositoryWizard(mContext, list));
        }
Beispiel #9
0
        private void grdActions_ItemDropped(object sender, EventArgs e)
        {
            Act dragedItem = (Act)((DragInfo)sender).Data;

            if (dragedItem != null)
            {
                WizardWindow.ShowWizard(new UploadItemToRepositoryWizard(mContext, dragedItem));
                //refresh and select the item
                try
                {
                    xActionListView.DataSourceList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Act>();

                    Act dragedItemInGrid = ((IEnumerable <Act>)xActionListView.DataSourceList).Where(x => x.Guid == dragedItem.Guid).FirstOrDefault();
                    if (dragedItemInGrid != null)
                    {
                        xActionListView.List.SelectedItem = dragedItemInGrid;
                    }
                }
                catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); }
            }
        }
Beispiel #10
0
        private void grdActivitiesRepository_ItemDropped(object sender, EventArgs e)
        {
            Activity dragedItem = (Activity)((DragInfo)sender).Data;

            if (dragedItem != null)
            {
                ////check if the Activity is part of a group which not exist in Activity repository
                WizardWindow.ShowWizard(new UploadItemToRepositoryWizard(mContext, dragedItem));

                //refresh and select the item
                try
                {
                    Activity dragedItemInGrid = ((IEnumerable <Activity>)xActivitiesRepositoryListView.DataSourceList).Where(x => x.Guid == dragedItem.Guid).FirstOrDefault();
                    if (dragedItemInGrid != null)
                    {
                        xActivitiesRepositoryListView.List.SelectedItem = dragedItemInGrid;
                    }
                }
                catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); }
            }
        }
Beispiel #11
0
        WizardPOM ShowMyWizard(string folder, double width = 0)
        {
            Task.Factory.StartNew(() => {
                mGingerAutomator.MainWindowPOM.Execute(() => {
                    MyWizard wiz = new MyWizard(folder);
                    if (width == 0)
                    {
                        WizardWindow.ShowWizard(wiz);
                    }

                    else
                    {
                        WizardWindow.ShowWizard(wiz, width);
                    }
                });
            });

            WizardPOM wizardPOM = WizardPOM.CurrentWizard;

            return(wizardPOM);
        }
Beispiel #12
0
        public ShowAuthPanel()
        {
            WrappedTextWidget userLoginPromptLabel = new WrappedTextWidget("Sign in to access your cloud printer profiles.\n\nOnce signed in you will be able to access:".Localize(), 12)
            {
                TextColor = ActiveTheme.Instance.PrimaryTextColor,
            };

            contentRow.AddChild(userLoginPromptLabel);

            AddBulletPointAndDescription(contentRow,
                                         "Cloud Library".Localize(),
                                         "Save your designs to the cloud and access them from anywhere in the world. You can also share them any time with with anyone you want.".Localize());
            AddBulletPointAndDescription(contentRow,
                                         "Cloud Profiles".Localize(),
                                         "Create your machine settings once, and have them available anywhere you want to print. All your changes appear on all your devices.".Localize());
            AddBulletPointAndDescription(contentRow,
                                         "Remote Monitoring".Localize(),
                                         "Check on your prints from anywhere. With cloud monitoring, you have access to your printer no matter where you go.".Localize());

            var nextButton = textImageButtonFactory.Generate("Skip".Localize());

            nextButton.Name   = "Connection Wizard Skip Sign In Button";
            nextButton.Click += (sender, e) =>
            {
                WizardWindow.ChangeToPage <SetupStepMakeModelName>();
            };

            var signInButton = textImageButtonFactory.Generate("Sign In".Localize());

            signInButton.Name   = "Sign In From Connection Wizard Button";
            signInButton.Click += (s, e) =>
            {
                WizardWindow.ShowAuthDialog?.Invoke();
                UiThread.RunOnIdle(WizardWindow.Close);
            };

            footerRow.AddChild(nextButton);
            footerRow.AddChild(new HorizontalSpacer());
            footerRow.AddChild(signInButton);
        }
Beispiel #13
0
        private void ImportGherkinFeature(object sender, RoutedEventArgs e)
        {
            BusinessFlow BF = null;

            if (WorkSpace.Instance.BetaFeatures.ImportGherkinFeatureWizrd)
            {
                WizardWindow.ShowWizard(new ImportGherkinFeatureWizard(mBusFlowsFolder.FolderFullPath));
            }
            else
            {
                // TODO: check test me
                string FeatureFolder = mBusFlowsFolder.FolderFullPath;
                if (!mBusFlowsFolder.FolderFullPath.EndsWith("BusinessFlows"))
                {
                    FeatureFolder = mBusFlowsFolder.FolderFullPath.Substring(mBusFlowsFolder.FolderFullPath.IndexOf("BusinessFlows\\") + 14);
                }
                ImportGherkinFeatureFilePage IFP = new ImportGherkinFeatureFilePage(FeatureFolder, ImportGherkinFeatureFilePage.eImportGherkinFileContext.BusinessFlowFolder);
                IFP.ShowAsWindow();
                BF = IFP.BizFlow;

                if (BF != null)
                {
                    //Refresh and select Faetures Folder
                    DocumentsFolderTreeItem DFTI = (DocumentsFolderTreeItem)mTreeView.Tree.GetChildItembyNameandSelect("Documents");
                    DFTI = (DocumentsFolderTreeItem)mTreeView.Tree.GetChildItembyNameandSelect("Features", DFTI);
                    if (mBusFlowsFolder.FolderFullPath != "Business Flows")
                    {
                        mTreeView.Tree.GetChildItembyNameandSelect(mBusFlowsFolder.FolderFullPath, DFTI);
                    }
                    mTreeView.Tree.RefreshSelectedTreeNodeChildrens();

                    //Select Business Folder
                    mTreeView.Tree.SelectItem(this);
                    mTreeView.Tree.RefreshSelectedTreeNodeChildrens();
                    BusinessFlowTreeItem BFTI = new BusinessFlowTreeItem(BF);

                    mTreeView.Tree.GetChildItembyNameandSelect(BF.Name, this);
                }
            }
        }
        private void ReLearnClicked(object sender, RoutedEventArgs e)
        {
            if (WorkSpace.Instance.Solution.GetTargetApplicationPlatform(mPOM.TargetApplicationKey) == GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib.ePlatformType.Java)
            {
                Reporter.ToUser(eUserMsgKey.MissingImplementationForPlatform, "Java");
                return;
            }
            if (mWinExplorer == null)
            {
                Reporter.ToUser(eUserMsgKey.POMAgentIsNotRunning);
                return;
            }

            if (mAgent.Driver.IsDriverBusy)
            {
                Reporter.ToUser(eUserMsgKey.POMDriverIsBusy);
                return;
            }


            WizardWindow.ShowWizard(new PomDeltaWizard(mPOM, mAgent), 1600, 800, true);
        }
        private void grdActivitiesGroupsRepository_ItemDropped(object sender, EventArgs e)
        {
            try
            {
                ActivitiesGroup dragedItem = null;

                if (((DragInfo)sender).Data is ActivitiesGroup)
                {
                    dragedItem = (ActivitiesGroup)((DragInfo)sender).Data;
                }
                else if (((DragInfo)sender).Data is CollectionViewGroup)
                {
                    dragedItem = mContext.BusinessFlow.ActivitiesGroups.Where(x => x.Name == ((DragInfo)sender).Header).FirstOrDefault();
                }

                if (dragedItem != null)
                {
                    //add the Group and it Activities to repository
                    List <RepositoryItemBase> list = new List <RepositoryItemBase>();
                    list.Add(dragedItem);
                    foreach (ActivityIdentifiers activityIdnt in dragedItem.ActivitiesIdentifiers)
                    {
                        list.Add(activityIdnt.IdentifiedActivity);
                    }
                    WizardWindow.ShowWizard(new UploadItemToRepositoryWizard(mContext, list));

                    //refresh and select the item
                    ActivitiesGroup dragedItemInGrid = ((IEnumerable <ActivitiesGroup>)xActivitiesGroupsRepositoryListView.DataSourceList).Where(x => x.Guid == dragedItem.Guid).FirstOrDefault();
                    if (dragedItemInGrid != null)
                    {
                        xActivitiesGroupsRepositoryListView.List.SelectedItem = dragedItemInGrid;
                    }
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Failed to drop " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " into Shared Repository", ex);
            }
        }
        /// <summary>
        /// Opens wizard window with ReserveSeats view
        /// Locks selected seats
        /// </summary>
        private void OnReserveSeats()
        {
            if (_wizardWindow == null)
            {
                WizardTitle   = "Создать заказ";
                FirstName     = String.Empty;
                MiddleName    = String.Empty;
                LastName      = String.Empty;
                CustomerEmail = String.Empty;
                CustomerPhone = String.Empty;
                SendSms       = false;

                LockSeats(SelectedSpots.ToArray());
                _wisardStep = WisardStep.Locked;

                _wizardWindow = new WizardWindow {
                    Owner = MetroWindow
                };

                ContentWindow = new ReserveViewModel(Instance);
                _wizardWindow.ShowDialog();
            }
        }
Beispiel #17
0
        internal async Task <bool> MapBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false)
        {
            Reporter.ToLog(eLogLevel.INFO, "Mapping " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + businessFlow.Name + " to ALM");
            //Passing Solution Folder path to GingerCore
            ALMCore.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();

            bool isMapSucc = false;

            try
            {
                Reporter.ToStatus(eStatusMsgKey.ALMTestSetMap);
                bool isConnected = false;
                await Task.Run(() =>
                {
                    isConnected = AutoALMProjectConnect(eALMConnectType.Auto);
                });

                if (isConnected)
                {
                    if (GetALMType().Equals(eALMType.ZephyrEnterprise))
                    {
                        WizardWindow.ShowWizard(new MapToALMWizard.AddMapToALMWizard(businessFlow), 1200);
                        isMapSucc = true;
                        DisconnectALMServer();
                    }
                    else
                    {
                        Reporter.ToUser(eUserMsgKey.StaticWarnMessage, $"'Map To ALM' - not Supporting {GetALMType()}.");
                    }
                }
            }
            finally
            {
                Reporter.HideStatusMessage();
            }
            return(isMapSucc);
        }
 private void LinkStatusImageBtn_Click(object sender, RoutedEventArgs e)
 {
     if (mLinkedRepoItem != null)
     {
         if (mLinkIsByParentID || mLinkIsByExternalID)
         {
             if (Reporter.ToUser(eUserMsgKey.AskIfSureWantToDeLink) == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
             {
                 mItem.ParentGuid = Guid.Empty;
                 mItem.ExternalID = string.Empty;
                 mItem.IsSharedRepositoryInstance = false;
                 SetRepoLinkStatus();
             }
         }
     }
     else
     {
         if (mItem != null)
         {
             WizardWindow.ShowWizard(new UploadItemToRepositoryWizard(mContext, mItem));
         }
         SetRepoLinkStatus();
     }
 }
Beispiel #19
0
        public ProjectConnectorData CreateProjectConnector()
        {
            try
            {
                WizardStory wizard = new WizardStory();
                //set the SCSM default connector icon here...
                wizard.WizardWindowTitle = ServiceManagerLocalization.GetStringFromManagementPack("strCreateConnector");
                ProjectConnectorData data = new ProjectConnectorData();

                //set the data.
                data.WizardMode   = WizardMode.Wizard;
                wizard.WizardData = data;

                //pages
                //add the connector setup pages here.
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strGeneral"), typeof(GeneralWizardPage), wizard.WizardData));
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strPWAConnectionPage"), typeof(PWAWizardPage), wizard.WizardData));
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strSchedulePage"), typeof(ScheduleWizardPage), wizard.WizardData));
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strResults"), typeof(ResultsWizardPage), wizard.WizardData));

                WizardWindow wizardWindow = new WizardWindow(wizard);
                ElementHost.EnableModelessKeyboardInterop(wizardWindow);

                //window properties
                wizardWindow.ShowInTaskbar         = true;
                wizardWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
                wizardWindow.Icon = BitmapFrame.Create(System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/Microsoft.EnterpriseManagement.ServiceManager.ProjectServer.ConsoleTasks;component/Icons/Image.Cireson.16x16.ico", UriKind.RelativeOrAbsolute)).Stream);
                wizardWindow.ShowDialog();
                return(data);
            }
            catch (Exception ex)
            {
                ConsoleContextHelper.Instance.ShowErrorDialog(ex, string.Empty, ConsoleJobExceptionSeverity.Error);
                return(null);
            }
        }
 public override void AddTreeItem()
 {
     WizardWindow.ShowWizard(new AddAgentWizard(mAgentsFolder));
 }
Beispiel #21
0
 public void AddPlugIn()
 {
     WizardWindow.ShowWizard(new AddPluginPackageWizard());
 }
Beispiel #22
0
 private void AddQuery(object sender, RoutedEventArgs e)
 {
     WizardWindow.ShowWizard(new AddDBQueryWizard(Path));
 }
Beispiel #23
0
 private void ImportOptionalValuesForGlobalParameters(object sender, RoutedEventArgs e)
 {
     WizardWindow.ShowWizard(new AddModelOptionalValuesWizard(mModelsGlobalParamsList));
     xModelsGlobalParamsGrid.DataSourceList = mModelsGlobalParamsList;
 }
Beispiel #24
0
        /// <summary>
        /// Generates relevant Action and adds to the current/selected Activity
        /// </summary>
        /// <param name="mItem"> of type object and would successfully add an action with Act/ElementInfo/ApplicationModels type object is provided</param>
        /// <param name="mContext"> required to identify the currently selected Activity, Action is to be added to </param>
        public static int AddActionsHandler(object mItem, Context mContext, int targetIndex = -1)
        {
            Act instance = null;

            if (mContext.Activity != null)
            {
                mContext.BusinessFlow.CurrentActivity = mContext.Activity;//so new Actions will be added to correct Activity
            }

            if (mItem is Act)
            {
                Act selectedAction = mItem as Act;
                instance = GenerateSelectedAction(selectedAction, mContext);
            }
            else if (mItem is ElementInfo)
            {
                ElementInfo elementInfo = mItem as ElementInfo;
                instance = GeneratePOMElementRelatedAction(elementInfo, mContext);
            }
            else if (mItem is ApplicationPOMModel)
            {
                ApplicationPOMModel currentPOM = mItem as ApplicationPOMModel;
                //required to show all the actions added as selected
                int updatedTargetIndex = targetIndex;
                foreach (ElementInfo elemInfo in currentPOM.MappedUIElements)
                {
                    instance = GeneratePOMElementRelatedAction(elemInfo, mContext);
                    if (instance != null)
                    {
                        instance.Active = true;
                        if (updatedTargetIndex > -1)
                        {
                            mContext.Activity.Acts.Insert(updatedTargetIndex, instance);
                            updatedTargetIndex++;
                        }
                        else
                        {
                            mContext.BusinessFlow.AddAct(instance, true);
                        }
                    }
                }
                mContext.Activity.Acts.CurrentItem = instance;
                instance    = null;
                targetIndex = updatedTargetIndex;
            }
            else if (mItem is ApplicationAPIModel || mItem is RepositoryFolder <ApplicationAPIModel> )
            {
                ObservableList <ApplicationAPIModel> apiModelsList = new ObservableList <ApplicationAPIModel>();
                if (mItem is RepositoryFolder <ApplicationAPIModel> )
                {
                    apiModelsList = (mItem as RepositoryFolder <ApplicationAPIModel>).GetFolderItems();
                    apiModelsList = new ObservableList <ApplicationAPIModel>(apiModelsList.Where(a => a.TargetApplicationKey != null && Convert.ToString(a.TargetApplicationKey.ItemName) == mContext.Target.ItemName));
                }
                else
                {
                    apiModelsList.Add(mItem as ApplicationAPIModel);
                }

                AddApiModelActionWizardPage APIModelWizPage = new AddApiModelActionWizardPage(mContext, apiModelsList);
                WizardWindow.ShowWizard(APIModelWizPage);
            }

            if (instance != null)
            {
                instance.Active = true;

                if (targetIndex > -1)
                {
                    mContext.Activity.Acts.Insert(targetIndex, instance);
                }
                else
                {
                    mContext.BusinessFlow.AddAct(instance, true);
                }
                mContext.Activity.Acts.CurrentItem = instance;
            }

            return(targetIndex);
        }
Beispiel #25
0
 private bool ImportSettingsMenu_Click()
 {
     UiThread.RunOnIdle(() => WizardWindow.Show <ImportSettingsPage>("ImportSettingsPage", "Import Settings Page"));
     return(true);
 }
Beispiel #26
0
 internal void AddItemHandler(object sender, RoutedEventArgs e)
 {
     WizardWindow.ShowWizard(new AddEnvironmentWizard(mProjEnvironmentFolder));
 }
 /// <summary>
 /// Initizales the WizardWindow.
 /// </summary>
 public WizardWindowInnards(WizardWindow wizardWindow)
 {
     InitializeComponent();
     _wizardWindow = wizardWindow;
     _wizardUserControls.CollectionChanged += new NotifyCollectionChangedEventHandler(WizardUserControls_CollectionChanged);
     DataContext = wizardWindow;
 }
 internal void AddItemHandler(object sender, RoutedEventArgs e)
 {
     WizardWindow.ShowWizard(new AddAgentWizard(mAgentsFolder));
 }
Beispiel #29
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);
            }
        }
Beispiel #30
0
        private DropDownMenu GetSliceOptionsMenuDropList()
        {
            DropDownMenu sliceOptionsMenuDropList;

            sliceOptionsMenuDropList = new DropDownMenu("Options".Localize() + "... ")
            {
                HoverColor        = new RGBA_Bytes(0, 0, 0, 50),
                NormalColor       = new RGBA_Bytes(0, 0, 0, 0),
                BorderColor       = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100),
                BackgroundColor   = new RGBA_Bytes(0, 0, 0, 0),
                BorderWidth       = 1,
                MenuAsWideAsItems = false,
                AlignToRightEdge  = true,
            };
            sliceOptionsMenuDropList.Name     = "Slice Settings Options Menu";
            sliceOptionsMenuDropList.VAnchor |= VAnchor.ParentCenter;


            showHelpBox = new CheckBox("Show Help".Localize());

            if (primarySettingsView)
            {
                // only turn on the help if in the main view and it is set to on
                showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true";
            }

            showHelpBox.CheckedStateChanged += (s, e) =>
            {
                if (primarySettingsView)
                {
                    // only save the help settings if in the main view
                    UserSettings.Instance.set(SliceSettingsShowHelpEntry, showHelpBox.Checked.ToString().ToLower());
                }
                ShowHelpChanged?.Invoke(this, null);
            };

            MenuItem showHelp = new MenuItem(showHelpBox, "Show Help Checkbox")
            {
                Padding = sliceOptionsMenuDropList.MenuItemsPadding,
            };

            sliceOptionsMenuDropList.MenuItems.Add(showHelp);
            sliceOptionsMenuDropList.AddHorizontalLine();

            sliceOptionsMenuDropList.AddItem("Import".Localize()).Selected += (s, e) => { ImportSettingsMenu_Click(); };
            sliceOptionsMenuDropList.AddItem("Export".Localize()).Selected += (s, e) => { WizardWindow.Show <ExportSettingsPage>("ExportSettingsPage", "Export Settings"); };

            MenuItem settingsHistory = sliceOptionsMenuDropList.AddItem("Restore Settings".Localize());

            settingsHistory.Selected += (s, e) => { WizardWindow.Show <PrinterProfileHistoryPage>("PrinterProfileHistory", "Restore Settings"); };

            settingsHistory.Enabled = !string.IsNullOrEmpty(AuthenticationData.Instance.ActiveSessionUsername);

            sliceOptionsMenuDropList.AddItem("Reset to Defaults".Localize()).Selected += (s, e) => { UiThread.RunOnIdle(ResetToDefaults); };

            return(sliceOptionsMenuDropList);
        }
 private void AddDBModel(object sender, RoutedEventArgs e)
 {
     WizardWindow.ShowWizard(new AddDBModelWizard(this.Path));
 }
Beispiel #32
0
 private void MoveToNextWidget()
 {
     WizardWindow.ChangeToInstallDriverOrComPortOne();
 }
        public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            // Store a copy of the replacements dictionary, used later for deleting the project if it was cancelled
            _replacementsDictionary = replacementsDictionary;
            string projectName          = replacementsDictionary["$projectname$"];
            string destinationDirectory = replacementsDictionary["$destinationdirectory$"];

            #region VSTemplate Parsing for NuGet Packages
            // Parse the VSTemplate for nuget package entries, this is the only way AFAIK to make them optional but at the detriment of them having to be downloaded
            // instead of locally available in the VSIX...
            if (customParams.Length > 0)
            {
                var vsTemplate = XDocument.Load((string)customParams[0]);
                IEnumerable <XElement> parsedPackages = vsTemplate.Descendants().Where(x => x.Name.LocalName == "package");

                foreach (XElement parsedPackage in parsedPackages)
                {
                    _nugetPackages.Add(parsedPackage.Attribute("id").Value);
                }
            }
            #endregion

            try
            {
                // Create a new instance of the WizardWindow
                wizardWindow = new WizardWindow();

                if (wizardWindow.ShowDialog().Value == true)
                {
                    // Set up the paths we need for the configuration. & should automatically be escaped with &amp;
                    bannerlordDirectory = wizardWindow.BannerlordDirectory;
                    bannerlordExe       = bannerlordDirectory + @"\bin\Win64_Shipping_Client\Bannerlord.exe";
                    createSubModule     = wizardWindow.IncludeSubModule;
                    createReadme        = wizardWindow.IncludeReadme;
                    addHarmony          = wizardWindow.IncludeHarmony;
                    useLauncherMods     = wizardWindow.UseLauncherMods;

                    // Parse the Bannerlord Launcher to find what modules were last used
                    StringBuilder argumentString = new StringBuilder();
                    List <string> moduleList     = wizardWindow.LauncherMods;

                    if (moduleList != null && moduleList.Count >= 1 && useLauncherMods)
                    {
                        argumentString.Append("/singleplayer _MODULES_*");
                        foreach (string module in moduleList)
                        {
                            argumentString.Append($"{module}*");
                        }
                        argumentString.Append($"{replacementsDictionary["$safeprojectname$"]}*_MODULES_");
                    }
                    else
                    {
                        argumentString.Append($"/singleplayer _MODULES_*Native*SandBoxCore*SandBox*StoryMode*CustomBattle*{replacementsDictionary["$safeprojectname$"]}*_MODULES_");
                    }

                    // Add our custom replacements to the dictionary
                    replacementsDictionary.Add("$BannerlordDirectory$", bannerlordDirectory);
                    replacementsDictionary.Add("$BannerlordExecutable$", bannerlordExe);
                    replacementsDictionary.Add("$BannerlordDebugArgs$", argumentString.ToString());

                    // We should be done now, close the window
                    wizardWindow.Close();
                }
                else
                {
                    // The user clicked cancel or closed the window, throw the exception
                    wizardWindow.Close();
                    throw new WizardBackoutException();
                }
            } catch (Exception ex) {
                if (ex.GetType().IsAssignableFrom(typeof(WizardBackoutException)) || ex.GetType().IsAssignableFrom(typeof(WizardCancelledException)))
                {
                    // Project folder would still have been created, clean it up if the user decided to back out
                    string projectFolder = Path.GetFullPath(Path.Combine(destinationDirectory, @"..\"));

                    if (Directory.Exists(projectFolder))
                    {
                        Directory.Delete(projectFolder, true);
                    }
                    else
                    {
                        Directory.Delete(destinationDirectory, true);
                    }
                    throw;
                }
                else
                {
                    MessageBox.Show($"An error has occurred!\n\nError Message:\n{ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
        public override void ExecuteCommand(IList<NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection<string> parameters)
        {
            if (parameters.Contains("Create"))
            {
                WizardStory wizard = new WizardStory();

                //set the icon and title bar
                ResourceManager rm = new ResourceManager("SCSM.Azureautomation.WPF.Connector.Resources", typeof(Resources).Assembly);
                Bitmap bitmap = (Bitmap)rm.GetObject("AzureAutomation2x32");
                IntPtr ptr = bitmap.GetHbitmap();
                BitmapSource bitmapsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                wizard.StoryImage = bitmapsource;
                wizard.WizardWindowTitle = "Create Azure Automation Connector";

                WizardData data = new AzureAutomationWizardData();
                wizard.WizardData = data;

                //add th pages
                wizard.AddLast(new WizardStep("Welcome", typeof(AzureAutomationWelcomePage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Configuration", typeof(AzureAutomationConfigurationPage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Summary", typeof(AzureAutomationSummaryPage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Results", typeof(AzureAutomationResultPage), wizard.WizardData));

                //Create a wizard window and show it
                WizardWindow wizardwindow = new WizardWindow(wizard);
                // this is needed so that WinForms will pass messages on to the hosted WPF control
                System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(wizardwindow);
                wizardwindow.ShowDialog();

                //Update the view when done with the wizard so that the new connector shows
                if (data.WizardResult == WizardResult.Success)
                {
                    RequestViewRefresh();
                }
            }
            else if (parameters.Contains("Edit"))
            {
                //Get the server name to connect to and connect to the server
                String strServerName = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\System Center\\2010\\Service Manager\\Console\\User Settings", "SDKServiceMachine", "localhost").ToString();
                EnterpriseManagementGroup emg = new EnterpriseManagementGroup(strServerName);

                //Get the object using the selected node ID
                String strID = String.Empty;
                foreach (NavigationModelNodeBase node in nodes)
                {
                    strID = node["$Id$"].ToString();
                }
                EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject<EnterpriseManagementObject>(new Guid(strID), ObjectQueryOptions.Default);

                //Create a new "wizard" (also used for property dialogs as in this case), set the title bar, create the data, and add the pages
                WizardStory wizard = new WizardStory();
                wizard.WizardWindowTitle = "Edit Azure Automation Connector";
                WizardData data = new AzureAutomationWizardData(emoAAConnector);
                wizard.WizardData = data;
                wizard.AddLast(new WizardStep("Configuration", typeof(AzureAutomationConfigurationPage), wizard.WizardData));

                //Show the property page
                PropertySheetDialog wizardWindow = new PropertySheetDialog(wizard);

                //Update the view when done so the new values are shown
                bool? dialogResult = wizardWindow.ShowDialog();
                if (dialogResult.HasValue && dialogResult.Value)
                {
                    RequestViewRefresh();
                }
            }
            else if (parameters.Contains("Delete") || parameters.Contains("Disable") || parameters.Contains("Enable"))
            {
                //Get the server name to connect to and create a connection
                String strServerName = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\System Center\\2010\\Service Manager\\Console\\User Settings", "SDKServiceMachine", "localhost").ToString();
                EnterpriseManagementGroup emg = new EnterpriseManagementGroup(strServerName);

                //Get the object using the selected node ID
                String strID = String.Empty;
                foreach (NavigationModelNodeBase node in nodes)
                {
                    strID = node["$Id$"].ToString();
                }
                EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject<EnterpriseManagementObject>(new Guid(strID), ObjectQueryOptions.Default);

                if (parameters.Contains("Delete"))
                {
                    //Remove the object from the database
                    IncrementalDiscoveryData idd = new IncrementalDiscoveryData();
                    idd.Remove(emoAAConnector);
                    idd.Commit(emg);
                }

                //Get the rule using the connector ID
                ManagementPack mpConnectors = emg.GetManagementPack("SCSM.AzureAutomation", null, new Version("1.0.0.0"));
                ManagementPackClass classAAConnector = mpConnectors.GetClass("SCSM.AzureAutomation.Connector");
                String strConnectorID = emoAAConnector[classAAConnector, "Id"].ToString();
                ManagementPackRule ruleConnector = mpConnectors.GetRule(strConnectorID);

                //Update the Enabled property or delete as appropriate
                if (parameters.Contains("Delete"))
                {
                    ruleConnector.Status = ManagementPackElementStatus.PendingDelete;
                }
                else if (parameters.Contains("Disable"))
                {
                    emoAAConnector[classAAConnector, "Enabled"].Value = false;
                    ruleConnector.Enabled = ManagementPackMonitoringLevel.@false;
                    ruleConnector.Status = ManagementPackElementStatus.PendingUpdate;
                }
                else if (parameters.Contains("Enable"))
                {
                    emoAAConnector[classAAConnector, "Enabled"].Value = true;
                    ruleConnector.Enabled = ManagementPackMonitoringLevel.@true;
                    ruleConnector.Status = ManagementPackElementStatus.PendingUpdate;
                }

                //Commit the changes to the connector object and rule
                emoAAConnector.Commit();
                mpConnectors.AcceptChanges();

                //Update the view when done so the item is either removed or the updated Enabled value shows
                RequestViewRefresh();
            }
        }