예제 #1
0
        public bool Load(string FileName)
        {
            featureFileName = FileName;
            GherkinTextEditor.SetContentEditorTitleLabel(Path.GetFileName(FileName) + " , Target " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": N/A", (Style)TryFindResource("@ucGridTitleLightStyle"));
            GherkinDcoumentEditor g = new GherkinDcoumentEditor();

            g.OptimizedSteps = mOptimizedSteps;
            g.OptimizedTags  = mTags;
            GherkinTextEditor.Init(FileName, g, true);
            mSolTags.ClearAll();
            foreach (GherkinTag tag in mTags)
            {
                Guid guid = GetTagInSolution(tag.Name);
                if (guid != Guid.Empty)
                {
                    mSolTags.Add(guid);
                }
            }

            string externalID = FileName.Replace(WorkSpace.Instance.Solution.Folder, "~");

            mBizFlow = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>().Where(x => x.Source == BusinessFlow.eSource.Gherkin && (x.ExternalID == externalID || x.ExternalID == FileName)).SingleOrDefault();

            ARP = new ActivitiesRepositoryPage(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Activity>(), new Context()
            {
                BusinessFlow = mBizFlow
            }, mSolTags, ArrowButtonHandler);
            //ARP.xActivitiesRepositoryListView.EnableTagsPanel = false;
            SharedActivitiesFrame.Content = ARP;

            BFName = FileName.Replace(WorkSpace.Instance.Solution.Folder, "");
            //to prevent creating a folder rather than putting them on BF level.
            if (BFName.Contains("Business Flows"))
            {
                BFName = BFName.Replace("Business Flows", "");
            }
            if (BFName.EndsWith(".feature"))
            {
                BFName = Path.GetFileName(FileName).Replace(".feature", "");
            }
            // search if we have the BF defined already, so search in BF will work

            if (mBizFlow != null)
            {
                BFName                 = mBizFlow.FileName;
                isBFexists             = true;
                UpdateBFButton.Content = "Update " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
                GherkinTextEditor.SetContentEditorTitleLabel(Path.GetFileName(FileName) + " , Target " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + mBizFlow.ContainingFolder + "\\" + mBizFlow.Name, (Style)TryFindResource("@ucGridTitleLightStyle"));
            }
            else
            {
                isBFexists             = false;
                UpdateBFButton.Content = "Create " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
            }
            SavePrompt();

            return(Optimize());
        }
예제 #2
0
        public bool Load(string FileName)
        {
            GherkinTextEditor.ContentEditorTitleLabel.Content = Path.GetFileName(FileName);
            GherkinTextEditor.ContentEditorTitleLabel.Style   = (Style)TryFindResource("@ucGridTitleLightStyle");
            GherkinDcoumentEditor g = new GherkinDcoumentEditor();

            g.OptimizedSteps = mOptimizedSteps;
            g.OptimizedTags  = mTags;
            GherkinTextEditor.Init(FileName, g, true);
            mSolTags.ClearAll();
            foreach (GherkinTag tag in mTags)
            {
                Guid guid = GetTagInSolution(tag.Name);
                if (guid != Guid.Empty)
                {
                    mSolTags.Add(guid);
                }
            }

            ARP = new ActivitiesRepositoryPage(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Activity>(), null, mSolTags, ArrowButtonHandler);
            ARP.xActivitiesRepositoryGrid.EnableTagsPanel = false;
            SharedActivitiesFrame.Content = ARP;

            BFName = FileName.Replace(App.UserProfile.Solution.Folder, "");
            //to prevent creating a folder rather than putting them on BF level.
            if (BFName.Contains("Business Flows"))
            {
                BFName = BFName.Replace("Business Flows", "");
            }
            BFName = BFName.Replace(@"Documents\Features\", "");
            BFName = BFName.Replace(".feature", "");
            BFName = folder + BFName + ".Ginger.BusinessFlow.xml";
            // search if we have the BF defined already, so search in BF will work
            mBizFlow = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>().Where(x => x.Name == BFName).SingleOrDefault();

            if (File.Exists(BFName))
            {
                isBFexists             = true;
                UpdateBFButton.Content = "Update " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
            }
            else
            {
                isBFexists             = false;
                UpdateBFButton.Content = "Create " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
            }
            SavePrompt();

            return(Optimize());
        }