Ejemplo n.º 1
0
        /// <summary>
        /// Undocks the current content into its own window
        /// </summary>
        public void UndockContent()
        {
            var viewResult = Content as ViewResult;

            if (viewResult == null)
            {
                return;
            }

            var parentTabControl = ElementHelper.FindParent <TabControl>(this);

            if (parentTabControl == null)
            {
                parentTabControl = ElementHelper.FindVisualTreeParent <TabControl>(this);
            }
            if (parentTabControl != null)
            {
                var oldIndex  = parentTabControl.SelectedIndex;
                var thisIndex = GetItemIndex(parentTabControl, this);
                if (oldIndex == thisIndex)
                {
                    var nextIndex = GetNextVisibleItemIndex(parentTabControl, oldIndex);
                    if (nextIndex != -1)
                    {
                        parentTabControl.SelectedIndex = nextIndex;
                    }
                    else
                    {
                        var previousIndex = GetPreviousVisibleItemIndex(parentTabControl, oldIndex);
                        if (previousIndex > -1)
                        {
                            parentTabControl.SelectedIndex = previousIndex;
                        }
                        else
                        {
                            parentTabControl.Visibility = Visibility.Collapsed;
                            SetParentTabItemVisibility(parentTabControl, Visibility.Collapsed);
                        }
                    }
                }
            }
            Visibility = Visibility.Collapsed;

            var window = new UndockedHierarchicalViewWindow(viewResult, this);

            window.Show();
            window.Activate();
        }
Ejemplo n.º 2
0
        public MobileBrowserTests()
        {
            ChromeMobileEmulationDeviceSettings deviceSettings = new ChromeMobileEmulationDeviceSettings();

            deviceSettings.Width     = 1024;
            deviceSettings.Height    = 1366;
            deviceSettings.UserAgent = "CustomDevice";

            ChromeOptions chromeOpt = new ChromeOptions();

            chromeOpt.EnableMobileEmulation(deviceSettings);

            setup   = new DriverSetUp();
            driver  = new ChromeDriver(setup.ChromeDriverFolder, chromeOpt);
            element = new ElementHelper(driver);
        }
Ejemplo n.º 3
0
        public static void ShowFlyout(ResourceDictionary resources, string flyoutName, FrameworkElement placementTarget, Action <KeyRoutedEventArgs> keyUpCallback)
        {
            var flyout = GetFlyout(resources, flyoutName);

            if (flyout != null)
            {
                _FlyoutKeyUpCallback = keyUpCallback;
                flyout.ShowAt(placementTarget);
                //키이벤트 등록
                TextBox tb = ElementHelper.FindVisualChild <TextBox>(flyout.Content);
                if (tb != null)
                {
                    tb.KeyUp += FlyoutKeyUp;
                }
            }
        }
Ejemplo n.º 4
0
        public static void HideFlyout(ResourceDictionary resources, string flyoutName)
        {
            var flyout = GetFlyout(resources, flyoutName);

            if (flyout != null)
            {
                flyout.Hide();
                //키이벤트 제거
                TextBox tb = ElementHelper.FindVisualChild <TextBox>(flyout.Content);
                if (tb != null)
                {
                    tb.KeyUp            -= FlyoutKeyUp;
                    _FlyoutKeyUpCallback = null;
                }
            }
        }
Ejemplo n.º 5
0
        public LoginPO(IWebDriver driver)
        {
            this.driver = driver;
            wait        = new TestWait(driver);
            helper      = new InputHelper();
            links       = new UrlLinks();
            element     = new ElementHelper(this.driver);

            byDivLoginTitle          = By.Id("login");
            byInputEmail             = By.Id("email-input-login");
            byInputPassword          = By.CssSelector("input[data-tstid='TextBox_Pass_Login']");
            byBtnLogin               = By.CssSelector("div.submit-button");
            bySpanRequiredLogin      = By.CssSelector("span[for=email-input-login]");
            bySpanRequiredPassword   = By.CssSelector("span[for=password-input-login]");
            bySpanWrongEmailPassword = By.CssSelector("span[id=js-passwordValidationMessage]");
            byRememberMeChkBox       = By.CssSelector("label[for=RememberMe]");
        }
Ejemplo n.º 6
0
        public Opening(OpeningTask task)
        {
            Task      = task;
            FrameList = new TFCOM.TFFrameListClass();

            BCOM.Level level = ElementHelper.GetOrCreateLevel(LEVEL_NAME);

            contour_ = task.GetContourShape();

            BCOM.SmartSolidElement body =
                App.SmartSolid.ExtrudeClosedPlanarCurve(contour_, task.Depth, 0.0, false);
            body.Level = level;
            ElementHelper.setSymbologyByLevel(body);

            FrameList.Add3DElement(body);
            FrameList.AsTFFrame.SetName(CELL_NAME);
        }
Ejemplo n.º 7
0
        //--------------------------------------------------------------------------------
        // Page
        //--------------------------------------------------------------------------------

        public static void SetDefaultFocus(this Page page)
        {
            var first = default(VisualElement);

            foreach (var visualElement in ElementHelper.EnumerateActive(page))
            {
                if (Focus.GetDefault(visualElement))
                {
                    visualElement.Focus();
                    return;
                }

                first ??= visualElement;
            }

            first?.Focus();
        }
Ejemplo n.º 8
0
        public void Should_return_ContentPage_as_parent()
        {
            var label = new Label();

            var page = new ContentPage
            {
                Content = label
            };

            var mgr  = new XamarinDesignSurfaceManager();
            var root = mgr.SetDesignSurface(page);

            var pair = mgr[label.Id];
            var cp   = ElementHelper.GetParents(pair.XenWidget);

            Assert.AreEqual(root.Id, cp[0].Id);
        }
Ejemplo n.º 9
0
        public void DataPoint(ref BCOM.Point3d Point, BCOM.View View)
        {
            PenetrUserTask userTask;

            if (!processInput(out userTask, ref Point, View))
            {
                return;
            }

            PenetrInfo penInfo = PenetrDataSource.Instance.getPenInfo(
                userTask.FlangesType,
                userTask.DiameterType.Number);

            ElementHelper.RunByRecovertingSettings(() => {
                PenetrHelper.addToModel(userTask, penInfo);
            });
        }
Ejemplo n.º 10
0
        public static bool isElementSp3dTask_Old(this Element element, out Sp3dTask_Old task)
        {
            P3DHangerPipeSupport  pipe      = null;
            P3DHangerStdComponent component = null;
            P3DEquipment          equipment = null;

            task = null;

            //string xmlSummary = string.Empty;
            var xmlSumBilder = new System.Text.StringBuilder();

            if (element == null)
            {
                return(false);
            }

            IEnumerable <string> summaryXmlData = ElementHelper.getSp3dXmlData(element);

            foreach (string xmlData in summaryXmlData)
            {
                if (xmlData.StartsWith("<P3DEquipment"))
                {
                    equipment = XmlSerializerEx.FromXml <P3DEquipment>(xmlData);
                }
                else if (xmlData.StartsWith("<P3DHangerPipeSupport"))
                {
                    pipe = XmlSerializerEx.FromXml <P3DHangerPipeSupport>(xmlData);
                }
                else if (xmlData.StartsWith("<P3DHangerStdComponent"))
                {
                    component = XmlSerializerEx.FromXml <P3DHangerStdComponent>(xmlData);
                }
            }

            if (equipment != null)
            {
                task = new Sp3dTask_Old(equipment, summaryXmlData);
            }
            else if (pipe != null && component != null)
            {
                task = new Sp3dTask_Old(pipe, component, summaryXmlData);
            }

            return(task != null);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Sets the visibility of the parent tab control of the current main tab within the hierarchy
        /// </summary>
        /// <param name="containedTabControl">The contained tab control.</param>
        /// <param name="visibility">The visibility.</param>
        private static void SetParentTabItemVisibility(TabControl containedTabControl, Visibility visibility)
        {
            var parentTab = ElementHelper.FindParent <TabItem>(containedTabControl);

            if (parentTab == null)
            {
                parentTab = ElementHelper.FindVisualTreeParent <TabItem>(containedTabControl);
            }
            if (parentTab == null)
            {
                return;
            }

            parentTab.Visibility = visibility;

            var parentTabControl = ElementHelper.FindParent <TabControl>(parentTab);

            if (parentTabControl == null)
            {
                ElementHelper.FindVisualTreeParent <TabControl>(parentTab);
            }
            if (parentTabControl == null)
            {
                return;
            }

            var parentTabIndex = GetItemIndex(parentTabControl, parentTab);

            if (visibility == Visibility.Visible)
            {
                parentTabControl.SelectedIndex = parentTabIndex;
            }
            else
            {
                var nextIndex = GetNextVisibleItemIndex(parentTabControl, parentTabIndex);
                if (nextIndex > -1)
                {
                    parentTabControl.SelectedIndex = nextIndex;
                }
                else
                {
                    parentTabControl.SelectedIndex = GetPreviousVisibleItemIndex(parentTabControl, parentTabIndex); // Could be -1, but so be it
                }
            }
        }
Ejemplo n.º 12
0
        private void Addin_SelectionChangedEvent(
            AddIn sender, AddIn.SelectionChangedEventArgs eventArgs)
        {
            try
            {
                if (eventArgs.Action == lastSelectionAction_ &&
                    eventArgs.FilePosition == lastFilePos_)
                {
                    return;
                }

                switch (eventArgs.Action)
                {
                case AddIn.SelectionChangedEventArgs.ActionKind.SetEmpty:
                    unselectAll_();
                    break;

                case AddIn.SelectionChangedEventArgs.ActionKind.Remove:
                {
                    Element element = ElementHelper.getElement(eventArgs);
                    unselectElement_(element);
                    break;
                }

                case AddIn.SelectionChangedEventArgs.ActionKind.New:
                {
                    Element element = ElementHelper.getElement(eventArgs);
                    selectElement_(element);
                    break;
                }
                }

                //TaskSelection.ResetBindings();
                OnPropertyChanged(NP.TaskSelection);
            }
            catch (Exception ex)
            {
                ex.AddToMessageCenter();
            }
            finally
            {
                lastSelectionAction_ = eventArgs.Action;
                lastFilePos_         = eventArgs.FilePosition;
            }
        }
Ejemplo n.º 13
0
        public static bool getFromElement(Element element, XDocument attrsXDoc, out PenetrVueTask penTask)
        {
            penTask = null;

            XDocument xDoc = ElementHelper.getSp3dXDocument(element);

            xDoc.Merge(attrsXDoc);

            Sp3dPenTask sp3dTask = new Sp3dPenTask(xDoc);

            if (sp3dTask.Type == Sp3dPenTask.TaskType.Pipe && sp3dTask.IsValid)
            {
                penTask = new PenetrVueTask(element, sp3dTask);
                Sp3dToDGMapping.Instance.LoadValuesFromXDoc(xDoc, penTask.DataGroupPropsValues);
            }

            return(penTask != null ? penTask.isValid : false);
        }
Ejemplo n.º 14
0
        private void initialize_(Element element = null)
        {
            DataGroupPropsValues = new Dictionary <Sp3dToDataGroupMapProperty, string>();
            FlangesGeom          = new List <PenetrTaskFlange>();
            TFFormsIntersected   = new List <TFCOM.TFElementList>();
            CompoundsIntersected = new List <TFCOM.TFElementList>();

            if (element != null)
            {
                Cell = element.ToCellElementCOM();
                long   id;
                IntPtr elRef, modelRef;
                ElementHelper.extractFromElement(element, out id, out elRef, out modelRef);
                elemRefP  = elRef;
                modelRefP = modelRef;
                elemId    = id;
            }
        }
Ejemplo n.º 15
0
        public string Submit()
        {
            //_cookiePolicyButton.Click();
            try
            {
                WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromMilliseconds(50));
                if (wait.Until(d => _driver.FindElements(By.XPath(COOKIE_POLICE)).Count > 0))
                {
                    _cookiePolicyButton.Click();
                }
            }
            catch (WebDriverTimeoutException e)
            {
            }
            _submitButton.Click();
            if (ElementHelper.HasElementText(_driver, By.XPath(EMAIL_INCORRECT), TimeSpan.FromMilliseconds(50)))
            {
                throw new TextException("Email is incorrect");
            }

            if (ElementHelper.HasElementText(_driver, By.XPath(PASSWORD_EMPTY), TimeSpan.FromMilliseconds(50)))
            {
                throw new TextException("Password is empty");
            }

            if (ElementHelper.HasElementText(_driver, By.XPath(CONFIRMATION_MAIL), TimeSpan.FromMilliseconds(50)))
            {
                return("Registration was successful");
            }
            // WebDriverWait wait = new WebDriverWait(_driver,TimeSpan.FromMilliseconds(50));
            // //if (wait.Until(d => _driver.FindElements(By.XPath(EMAIL_INCORRECT)).Count>0))
            // if (wait.Until(d => _tmp.Text != ""))
            // {
            //     string tmp = _tmp.Text;
            //     string tmp2 = _driver.FindElements(By.XPath(EMAIL_INCORRECT)).FirstOrDefault().Text;
            //     throw new TextException("Email is incorrect");
            // }

            // if (wait.Until(d => _driver.FindElements(By.XPath(PASSWORD_EMPTY)).Count>0))
            // {
            //     throw new TextException("Password is empty");
            // }
            return("Registration was unsuccessful");
        }
        /// <summary>
        /// Handles the <see cref="E:MouseDown" /> event.
        /// </summary>
        /// <param name="e">The <see cref="MouseButtonEventArgs"/> instance containing the event data.</param>
        protected override void OnMouseDown(MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                var tab = ElementHelper.FindParent <HierarchicalViewHostTabItem>(this);
                if (tab == null)
                {
                    tab = ElementHelper.FindVisualTreeParent <HierarchicalViewHostTabItem>(this);
                }
                if (tab != null)
                {
                    tab.UndockContent();
                    e.Handled = true;
                    return;
                }
            }

            base.OnMouseDown(e);
        }
Ejemplo n.º 17
0
        public string ToString(Indent indent)
        {
            var builder     = new StringBuilder();
            var innerIndent = indent.Increment();

            builder.Append(indent.Value)
            .AppendFormat("branch ({0}):", this.OpCode)
            .AppendLine()
            .Append(innerIndent.Value)
            .Append("target:")
            .AppendLine()
            .Append(ElementHelper.ToString(this.Target, innerIndent.Increment()));

            builder.AppendLine()
            .Append(innerIndent.Value)
            .Append("fallback:")
            .AppendLine()
            .Append(ElementHelper.ToString(this.Fallback, innerIndent.Increment()));
            return(builder.ToString());
        }
        public static bool SetMapTagOnElement(BCOM.Element element,
                                              TagToDataGroupMapProperty mapProperty)
        {
            object propValue = DataGroupHelper.GetDataGroupPropertyValue(
                element, mapProperty.DataGroupXPath);

            if (propValue == null)
            {
                return(false);
            }

            MsdTagType tagType;

            if (propValue is string)
            {
                tagType = MsdTagType.Character;
            }
            else if (propValue is double)
            {
                tagType = MsdTagType.Double;
            }
            else if (propValue is int)
            {
                tagType = MsdTagType.ShortInteger;
            }
            else if (propValue is long)
            {
                tagType = MsdTagType.LongInteger;
            }
            else if (propValue is Byte[])
            {
                tagType = MsdTagType.ShortInteger;
            }
            else
            {
                tagType = MsdTagType.Character;
            }

            return(ElementHelper.setTagOnElement(element, mapProperty.TagSetName,
                                                 mapProperty.TagName, propValue, tagType));
        }
Ejemplo n.º 19
0
        public void LoadJumpTable()
        {
            string originalFilePath = Path.Combine(ProjectFolder.rootDir, ProjectFolder.unpackedGameFilesDir, JUMP_TABLE_FILE);

            FileStream   fs = new FileStream(originalFilePath, FileMode.Open);
            BinaryReader br = new BinaryReader(fs);

            footer.Read(br);
            header.Read(br);

            long streamEnd = br.BaseStream.Length - ElementHelper.GetElementSize(footer);

            while (br.BaseStream.Position != streamEnd)
            {
                var nextEntry = new JumpTableEntry();
                nextEntry.Read(br);
                jumpTableEntries.Add(nextEntry);
            }

            br.Close();
        }
Ejemplo n.º 20
0
 /// <summary>
 ///     Cut Element
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CutElementToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (trvData.DatatreeView.SelectedNode.Level == 1 & trvData.DatatreeView.SelectedNode.PrevNode == null)
     {
         MyMessageBox.ShowMessage("Error", "_id can't be cut");
         return;
     }
     if (trvData.DatatreeView.SelectedNode.Parent.Text.EndsWith(ConstMgr.ArrayMark))
     {
         ElementHelper.CutValue(trvData.DatatreeView.SelectedNode.FullPath,
                                trvData.DatatreeView.SelectedNode.Index, (BsonValue)trvData.DatatreeView.SelectedNode.Tag, null,
                                null);
     }
     else
     {
         ElementHelper.CutElement(trvData.DatatreeView.SelectedNode.FullPath,
                                  (BsonElement)trvData.DatatreeView.SelectedNode.Tag, null, null);
     }
     trvData.DatatreeView.Nodes.Remove(trvData.DatatreeView.SelectedNode);
     IsNeedRefresh = true;
 }
Ejemplo n.º 21
0
        public HomePO(IWebDriver driver)
        {
            this.driver = driver;
            wait        = new TestWait(driver);
            links       = new UrlLinks();
            cookie      = new CookiesHelper(driver);
            element     = new ElementHelper(driver);

            byIconLogin                = By.ClassName("icon-user");
            byUserDetailName           = By.Id("ff-details-account");
            byUserName                 = By.ClassName("js-details-account-name");
            byGreetingMessage          = By.XPath("//a[@href='/useraccount.aspx?ffref=nb_name']");
            byBtnExit                  = By.XPath("//a[@href='/br/account/logout?ffref=hd_lidd_so']");
            byBtnLogin                 = By.XPath("//a[@href='/br/login.aspx']");
            byDetailsDrawer            = By.Id("ff-details-drawer");
            byGenderMaleFilter         = By.XPath("//a[@href='/br/shopping/men/items.aspx?ffref=hd_mnav']");
            byGenderMaleClothingFilter = By.XPath("//a[@href='/br/shopping/men/clothing-2/items.aspx']");
            byNewsLetterCloseBtn       = By.CssSelector("button[data-test=Go_NewsletterModalCloseButton]");
            bySideMenu                 = By.CssSelector("a[data-test='ff-sidenav']");
            byHeader = By.CssSelector("header[data-test='slice-header']");
        }
Ejemplo n.º 22
0
        private void startLeaderPrimitive(BCOM.Element bcomElement)
        {
            Element element = ElementHelper.getElement(bcomElement);

            if (element == null)
            {
                return;
            }

            var schemas = DataGroupDocument.Instance.CatalogSchemas.Schemas;

            using (var catalogEditHandle = new CatalogEditHandle(element, true, true))
            {
                string code = "### code";
                string name = "### name";

                foreach (DataGroupProperty property in catalogEditHandle.GetProperties())
                {
                    if (property?.Xpath == "EmbPart/@PartCode")
                    {
                        code = property.Value.ToString();
                    }
                    else if (property?.Xpath == "EmbPart/@CatalogName")
                    {
                        name = property.Value.ToString();
                    }
                }

                PenetrLeaderPrimitiveCmd.StartCommand(new PenetrLeaderInfo()
                {
                    TextLines = new List <string>()
                    {
                        code, name
                    }
                });

                // TODO решить проблему вылета при команде Modify DataGroup Instance
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 ///     删除元素
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DropElementToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (trvData.DatatreeView.SelectedNode.Level == 1 & trvData.DatatreeView.SelectedNode.PrevNode == null)
     {
         MyMessageBox.ShowMessage("Error", "_id Can't be delete");
         return;
     }
     if (trvData.DatatreeView.SelectedNode.Parent.Text.EndsWith(ConstMgr.ArrayMark))
     {
         ElementHelper.DropArrayValue(trvData.DatatreeView.SelectedNode.FullPath,
                                      trvData.DatatreeView.SelectedNode.Index, RuntimeMongoDbContext.CurrentDocument,
                                      RuntimeMongoDbContext.GetCurrentCollection());
     }
     else
     {
         ElementHelper.DropElement(trvData.DatatreeView.SelectedNode.FullPath,
                                   (BsonElement)trvData.DatatreeView.SelectedNode.Tag, RuntimeMongoDbContext.CurrentDocument,
                                   RuntimeMongoDbContext.GetCurrentCollection());
     }
     trvData.DatatreeView.Nodes.Remove(trvData.DatatreeView.SelectedNode);
     IsNeedRefresh = true;
 }
Ejemplo n.º 24
0
        public void GridViewLoaded(object sender, RoutedEventArgs e)
        {
            var gridView = sender as GridView;

            if (gridView != null)
            {
                var page = ElementHelper.FindVisualParent <Views.CloudPage>(gridView);
                if (page != null)
                {
                    Resources = page.Resources;
                    //초기값 로드
                    ChangeStyleSelector("NetworkItemStyleSelector", Windows.UI.Xaml.Window.Current.Bounds.Width);
                }
            }

            //로딩된 리스트가 존재하는 경우, 설정에서 back버튼이 활성화 되어 있으면 상위 폴더가 존재하는 경우 버튼을 활성화 시킴
            if (Settings.General.UseHardwareBackButtonWithinVideo &&
                pathStack.Any())
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            }
        }
Ejemplo n.º 25
0
        TFCOM.TFFrameList createFrameList(PenetrTask task)
        {
            BCOM.Level level     = ElementHelper.getOrCreateLevel(PenetrTask.LEVEL_NAME);
            BCOM.Level levelSymb =
                ElementHelper.getOrCreateLevel(PenetrTask.LEVEL_SYMB_NAME);
            BCOM.Level levelRefPoint =
                ElementHelper.getOrCreateLevel(PenetrTask.LEVEL_POINT_NAME);

            long       diamIndex = DiameterType.Parse(task.DiameterTypeStr).number;
            PenetrInfo penInfo   = penData.getPenInfo(task.FlangesType, diamIndex);

            TFCOM.TFFrameList frameList =
                PenetrHelper.createFrameList(task, penInfo, level);

            PenetrHelper.addProjection(ref frameList,
                                       task, penInfo, levelSymb, levelRefPoint);

            // TODO видимость контура перфоратора можно в конфиг. переменную
            PenetrHelper.addPerforator(ref frameList, task, penInfo, levelSymb, false);

            return(frameList);
        }
Ejemplo n.º 26
0
        public ProductPO(IWebDriver driver)
        {
            this.driver = driver;
            links       = new UrlLinks();
            strHelper   = new StringHelper();
            convert     = new ConvertHelper();
            element     = new ElementHelper(this.driver);

            byProductGallery        = By.CssSelector("div[data-tstid=gallery-and-productoffer");
            byBtnSizeGuide          = By.CssSelector("button[data-tstid=sizeGuideButton");
            byBrandName             = By.CssSelector("a[data-tstid=cardInfo-title");
            byProductDescription    = By.CssSelector("span[data-tstid=cardInfo-description");
            byPriceInfo             = By.CssSelector("span[data-tstid=priceInfo-original]");
            byDivProductCollapser   = By.CssSelector("div[data-tstid=collapser]");
            bySizeAndMeas           = By.Id("tamanhos-&-medidas");
            bySizeAndFitCollapser   = By.CssSelector("div[data-tstid=sizeAndFitCollapserArea]");
            byCategoryBreadCrumb    = By.CssSelector("ol[data-tstid=breadcrumb]");
            byMeasToogle            = By.CssSelector("div[data-tstid=measurementsToggle]");
            byModelMeas             = By.CssSelector("div[data-tstid=modelMeasurements]");
            byModelMeasTable        = By.CssSelector("div[data-tstid=modelMeasurements]  >table");
            bySpanMeasToogleProduct = By.CssSelector("div[data-tstid=measurementToggle] > span");
        }
Ejemplo n.º 27
0
        //public static TFCOM.TFFrameListClass createFrameList(
        //    PenetrTaskBase task, PenetrInfo penInfo, BCOM.Level level)
        //{
        //    var taskUOR = new UOR(App.ActiveModelReference);

        //    double pipeInsideDiam = penInfo.pipeDiameterInside / taskUOR.activeSubPerMaster;
        //    double pipeOutsideDiam = penInfo.pipeDiameterOutside / taskUOR.activeSubPerMaster;

        //    double flangeInsideDiam = penInfo.flangeDiameterInside / taskUOR.activeSubPerMaster;
        //    double flangeOutsideDiam = penInfo.flangeDiameterOutside / taskUOR.activeSubPerMaster;
        //    double flangeThick = penInfo.flangeThick / taskUOR.activeSubPerMaster;

        //    double length = task.LengthCm *10 / taskUOR.activeSubPerMaster;

        //    var solids = App.SmartSolid;

        //    /*
        //        ! длина трубы меньше размера проходки на толщину фланца
        //        ! ЕСЛИ ФЛАНЕЦ ЕСТЬ
        //    */

        //    // BCOM.Element template = App.createPointElement();

        //    double delta = task.FlangesCount == 0 ? 0 :
        //        task.FlangesCount * flangeThick / 2;

        //    BCOM.SmartSolidElement cylindrInside =
        //        solids.CreateCylinder(null, pipeInsideDiam / 2, length - delta);

        //    BCOM.SmartSolidElement cylindrOutside =
        //        solids.CreateCylinder(null, pipeOutsideDiam / 2, length - delta);

        //    var cylindr = solids.SolidSubtract(cylindrOutside, cylindrInside);

        //    var elements = new Dictionary<BCOM.Element, double>();
        //    //elements.Add(cylindrInside, 0);

        //    {
        //        double shift  = task.FlangesCount == 1 ? delta : 0;
        //        shift *= 1;
        //        elements.Add(cylindr, (length + shift)/2);
        //    }

        //    // Фланцы:
        //    for (int i = 0; i < task.FlangesCount; ++i)
        //    {
        //        BCOM.SmartSolidElement flangeCylindr = solids.SolidSubtract(
        //            solids.CreateCylinder(null, flangeOutsideDiam / 2, flangeThick),
        //            solids.CreateCylinder(null, pipeOutsideDiam / 2, flangeThick));

        //        double shift = 0;
        //        if (task.FlangesCount == 1)
        //        {
        //            //bool isNearest = App.Vector3dEqualTolerance(task.singleFlangeSide,
        //            //    App.Vector3dFromXYZ(0, 0, -1), 0.1); // 0.001

        //            bool isNearest = true;

        //            // 0.5 - для видимости фланцев на грани стены/плиты
        //            shift = isNearest ?
        //                    0.0    + flangeThick / 2 - task.FlangeWallOffset:
        //                    length - flangeThick / 2 + task.FlangeWallOffset;
        //        }
        //        else
        //        {
        //            shift = i == 0 ? 0.0 : length;
        //            // для самих фланцев:
        //            // 0.5 - для видимости фланцев на грани стены/плиты
        //            shift += Math.Pow(-1, i) * (flangeThick/2 - task.FlangeWallOffset); //0.02);
        //        }
        //        elements.Add(flangeCylindr, shift);
        //    }

        //    BCOM.Transform3d taskTran = App.Transform3dFromMatrix3d(task.Rotation);

        //    //double aboutX, aboutY, aboutZ;
        //    //task.getCorrectiveAngles(out aboutX, out aboutY, out aboutZ);

        //    TFCOM.TFFrameListClass frameList = new TFCOM.TFFrameListClass();

        //    foreach (var pair in elements)
        //    {
        //        BCOM.Element elem = pair.Key;
        //        double shift = pair.Value;

        //        // elem.Color = 0; // TODO
        //        BCOM.Point3d offset = App.Point3dAddScaled(
        //            App.Point3dZero(), App.Point3dFromXYZ(0, 0, 1), shift);
        //        elem.Move(offset);

        //        //elem.Rotate(App.Point3dZero(), aboutX, aboutY, aboutZ);

        //        elem.Transform(taskTran);
        //        elem.Move(task.Location);

        //        //elem.Level = level;
        //        //ElementHelper.setSymbologyByLevel(elem);

        //        // frameList.AsTFFrame.Add3DElement(elem);
        //        frameList.Add3DElement(elem);
        //    }

        //    //frameList.SetName(PenetrVueTask.CELL_NAME); // ранее было 'EmbeddedPart'
        //    return frameList;
        //}


        public static void addProjection(
            TFCOM.TFFrameList frame, IPenetrTask task, PenetrInfo penInfo)
        {
            var taskUOR = new UOR(task.ModelRef);

            double pipeInsideDiam  = penInfo.pipeDiameterInside / taskUOR.activeSubPerMaster;
            double pipeOutsideDiam = penInfo.pipeDiameterOutside / taskUOR.activeSubPerMaster;

            double flangeInsideDiam  = penInfo.flangeDiameterInside / taskUOR.activeSubPerMaster;
            double flangeOutsideDiam = penInfo.flangeDiameterOutside / taskUOR.activeSubPerMaster;
            double flangeThick       = penInfo.flangeThick / taskUOR.activeSubPerMaster;
            double length            = task.LengthCm * 10 / taskUOR.activeSubPerMaster;

            App.Point3dZero();
            frame.AddProjection(ElementHelper.createCrossRound(pipeInsideDiam)
                                .transformByTask(task), "cross", PenetrTaskBase.LevelSymb);
            frame.AddProjection(ElementHelper.createCircle(pipeInsideDiam)
                                .transformByTask(task), "circle", PenetrTaskBase.LevelSymb);
            frame.AddProjection(ElementHelper.createCrossRound(pipeInsideDiam)
                                .transformByTask(task, shiftZ: length), "cross", PenetrTaskBase.LevelSymb);
            frame.AddProjection(ElementHelper.createCircle(pipeInsideDiam)
                                .transformByTask(task, shiftZ: length), "circle", PenetrTaskBase.LevelSymb);
            if (task.FlangesCount > 0)
            {
                frame.AddProjection(ElementHelper.createCircle(flangeOutsideDiam).
                                    transformByTask(task, 0.0, 0.0, -task.FlangeWallOffset),
                                    "flange", PenetrTaskBase.LevelFlangeSymb);

                if (task.FlangesCount == 2)
                {
                    frame.AddProjection(ElementHelper.createCircle(flangeOutsideDiam).
                                        transformByTask(task, 0.0, 0.0, length + task.FlangeWallOffset),
                                        "flange", PenetrTaskBase.LevelFlangeSymb);
                }
            }
            frame.AddProjection(ElementHelper.createPoint().transformByTask(task),
                                "refPoint", PenetrTaskBase.LevelRefPoint);
        }
Ejemplo n.º 28
0
        public string ToString(Indent indent)
        {
            var builder = new StringBuilder();

            builder.Append(indent.Value)
            .Append("if ")
            .Append(this.Condition)
            .Append(" then:")
            .AppendLine()
            .Append(ElementHelper.ToString(this.Then, indent.Increment()));

            if (this.Else.Count == 0)
            {
                return(builder.ToString());
            }

            builder.AppendLine()
            .Append(indent.Value)
            .Append("else:")
            .AppendLine()
            .Append(ElementHelper.ToString(this.Else, indent.Increment()));
            return(builder.ToString());
        }
Ejemplo n.º 29
0
        public void GridViewLoaded(object sender, RoutedEventArgs e)
        {
            var gridView = sender as GridView;

            if (gridView != null)
            {
                var page = ElementHelper.FindVisualParent <Views.DLNAPage>(gridView);
                if (page != null)
                {
                    Resources = page.Resources;
                    //초기값 로드
                    ChangeStyleSelector("StorageItemStyleSelector", Windows.UI.Xaml.Window.Current.Bounds.Width);
                }
            }

            //로딩된 리스트가 존재하는 경우, 설정에서 back버튼이 활성화 되어 있으면 상위 폴더가 존재하는 경우 버튼을 활성화 시킴
            if (Settings.General.UseHardwareBackButtonWithinVideo &&
                (StorageItemGroupSource.Where(x => x.Type == StorageItemTypes.Folder).SelectMany(x => x.Items.Cast <StorageItemInfo>()).Any(x => x.Path != x.RootPath) ||
                 StorageItemGroupSource.Where(x => x.Type == StorageItemTypes.File).SelectMany(x => x.Items).Any(x => x.Path != x.ParentFolderPath)))
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            }
        }
Ejemplo n.º 30
0
        public void GenerateValidDocumentUploadUrl_ShouldReturnUrlWithCaseRefEncoded()
        {
            //Arrange
            var schema = new FormSchemaBuilder()
                         .WithName("form-name")
                         .Build();

            var formAnswers = new FormAnswers
            {
                CaseReference = "12345"
            };

            var urlOrigin     = $"https://www.test.com/";
            var caseReference = Convert.ToBase64String(Encoding.ASCII.GetBytes(formAnswers.CaseReference));
            var urlPath       = $"{schema.BaseURL}/{FileUploadConstants.DOCUMENT_UPLOAD_URL_PATH}{SystemConstants.CaseReferenceQueryString}{caseReference}";

            _mockElementHelper.Setup(_ => _.GenerateDocumentUploadUrl(It.IsAny <Element>(),
                                                                      It.IsAny <FormSchema>(),
                                                                      It.IsAny <FormAnswers>()
                                                                      )
                                     );

            var elementHelper = new ElementHelper(
                _mockDistributedCacheWrapper.Object,
                _mockElementMapper.Object,
                _mockWebHostEnvironment.Object,
                _mockHttpContextAccessor.Object
                );
            //Act
            var results = elementHelper.GenerateDocumentUploadUrl(new DocumentUpload(), schema, formAnswers);

            //Assert
            Assert.NotNull(results);
            Assert.Equal($"{urlOrigin}{urlPath}", results);
            Assert.Contains(caseReference, results);
        }