Ejemplo n.º 1
0
        // For the HTML element, it should call this method with ns and prefix as String.Empty
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);

            elementScope.Push((byte)currentElementProperties);

            if (ns.Length == 0)
            {
                Debug.Assert(prefix.Length == 0);

                if (trackTextContent && inTextContent != false)
                {
                    ChangeTextContentMark(false);
                }

                currentElementProperties = (ElementProperties)elementPropertySearch.FindCaseInsensitiveString(localName);
                base.bufChars[bufPos++]  = (char)'<';
                base.RawText(localName);
                base.attrEndPos = bufPos;
            }
            else
            {
                // Since the HAS_NS has no impact to the ElementTextBlock behavior,
                // we don't need to push it into the stack.
                currentElementProperties = ElementProperties.HAS_NS;
                base.WriteStartElement(prefix, localName, ns);
            }
        }
Ejemplo n.º 2
0
        internal override void WriteFullEndElement(string prefix, string localName, string ns)
        {
            if (ns.Length == 0)
            {
                Debug.Assert(prefix.Length == 0);

                if (trackTextContent && inTextContent != false)
                {
                    ChangeTextContentMark(false);
                }

                if ((currentElementProperties & ElementProperties.EMPTY) == 0)
                {
                    bufChars[base.bufPos++] = (char)'<';
                    bufChars[base.bufPos++] = (char)'/';
                    base.RawText(localName);
                    bufChars[base.bufPos++] = (char)'>';
                }
            }
            else
            {
                //xml content
                base.WriteFullEndElement(prefix, localName, ns);
            }

            currentElementProperties = (ElementProperties)elementScope.Pop();
        }
Ejemplo n.º 3
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static List <BuildingElement> SetBuildingElementTypeByAdjacencies(this List <BuildingElement> elements)
        {
            foreach (BuildingElement be in elements)
            {
                ElementProperties elementProps = be.ElementProperties() as ElementProperties;
                if (elementProps == null)
                {
                    elementProps = new ElementProperties();
                    be.ExtendedProperties.Add(elementProps);
                }

                BuildingElementContextProperties contextProps = be.ContextProperties() as BuildingElementContextProperties;
                if (contextProps == null)
                {
                    contextProps = new BuildingElementContextProperties();
                    be.ExtendedProperties.Add(contextProps);
                }

                if (contextProps.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 0)
                {
                    elementProps.BuildingElementType = BuildingElementType.Shade;
                }
                else if (contextProps.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 1)
                {
                    elementProps.BuildingElementType = BuildingElementType.WallExternal;
                }
                else if (contextProps.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 2)
                {
                    elementProps.BuildingElementType = BuildingElementType.WallInternal;
                }
            }

            return(elements);
        }
Ejemplo n.º 4
0
        public void createSmartArea(string _ip, PointF pt, double angle)
        {
            //Init SmartArea Control
            SmartArea smartArea = new SmartArea();

            ElementProperties prop = new ElementProperties();

            prop.ElementSupport.AddSupport(TouchFramework.TouchAction.Drag);
            prop.ElementSupport.AddSupport(TouchFramework.TouchAction.Tap);

            MTSmoothContainer smartAreaCont = new MTSmoothContainer(smartArea, main, prop);

            framework.RegisterElement(smartAreaCont);

            smartArea.Tag        = _ip;
            smartAreaCont.userIP = _ip;

            main.Children.Add(smartArea);
            smartArea.setInit(main, window, framework, smartAreaCont, _ip, angle);

            smartAreaCont.SetPosition(pt.X, pt.Y, angle, 1.0);

            SingleToneTrans.getInstance().addToArea(smartArea);
            SingleToneTrans.getInstance().addToCont(smartAreaCont);
        }
Ejemplo n.º 5
0
        internal void UpdateSelNode(ElementProperties elementProperties, string snapshotPath)
        {
            TreeMerger treeMerger = new TreeMerger(_modelTreeView.GetTreeView(),
                                                   AppEnvironment.SetModelChanged, this.UpdateNodePropertyCompleteHandler
                                                   );

            treeMerger.UpdateSelNode(elementProperties, snapshotPath);
        }
Ejemplo n.º 6
0
        private void lvItem_lnLinkItemClick(object sender, EventArgs e)
        {
            ListViewItem      lvItem = (sender as LinkLabel).Tag as ListViewItem;
            ElementProperties ep     = lvItem.Tag as ElementProperties;

            _clickedElement = ep.AutomationElement;
            Utility.AsyncCall(() => _elementsBuilder.RenewElementsByChild(ep.AutomationElement));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Constructor for MTElementC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ontainer.
        /// </summary>
        /// <param name="createFrom">The FrameworkElement this container is going to store touches for and manipulate.</param>
        public MTSmoothContainerRev(FrameworkElement createFrom, Panel cont, ElementProperties props)
            : base(createFrom, cont, props)
        {
            this.ScaleFilter.Reset(1.0f, 1.0f);

            this.Delay = 100;
            this.DampingDelay = 1200;
        }
Ejemplo n.º 8
0
        public static bool UpdateBCFParameters(Document doc, ElementProperties ep, IssueEntry issue, Comment comment)
        {
            bool result = false;

            try
            {
                foreach (BCFParameters param in Enum.GetValues(typeof(BCFParameters)))
                {
                    switch (param)
                    {
                    case BCFParameters.BCF_Action:
                        result = UpdateBCFParameter(doc, ep, BCFParameters.BCF_Action, ep.Action);
                        break;

                    case BCFParameters.BCF_Author:
                        if (null != comment)
                        {
                            result = UpdateBCFParameter(doc, ep, BCFParameters.BCF_Author, comment.Author);
                        }
                        break;

                    case BCFParameters.BCF_Comment:
                        if (null != comment)
                        {
                            result = UpdateBCFParameter(doc, ep, BCFParameters.BCF_Comment, comment.Comment1);
                        }
                        break;

                    case BCFParameters.BCF_Date:
                        if (null != comment)
                        {
                            result = UpdateBCFParameter(doc, ep, BCFParameters.BCF_Date, comment.Date.ToString());
                        }
                        break;

                    case BCFParameters.BCF_IssueNumber:
                        break;

                    case BCFParameters.BCF_Name:
                        result = UpdateBCFParameter(doc, ep, BCFParameters.BCF_Name, issue.BCFName);
                        break;

                    case BCFParameters.BCF_Responsibility:
                        result = UpdateBCFParameter(doc, ep, BCFParameters.BCF_Responsibility, ep.ResponsibleParty);
                        break;

                    case BCFParameters.BCF_Topic:
                        result = UpdateBCFParameter(doc, ep, BCFParameters.BCF_Topic, issue.IssueTopic);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to update BCF Parameter." + ex.Message, "Update BCF Parameters", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            return(result);
        }
Ejemplo n.º 9
0
        /***************************************************/

        public static BuildingElement BuildingElement(ElementProperties elementProperties, IEnumerable <Polyline> panelPolyLines)
        {
            return(new BuildingElement
            {
                PanelCurve = Geometry.Create.PolyCurve(panelPolyLines),
                ExtendedProperties = new List <IBHoMExtendedProperties> {
                    elementProperties
                },
            });
        }
Ejemplo n.º 10
0
        /***************************************************/

        public static BuildingElement BuildingElement(ElementProperties elementProperties, ICurve panelCurve)
        {
            return(new BuildingElement
            {
                ExtendedProperties = new List <IBHoMExtendedProperties> {
                    elementProperties
                },
                PanelCurve = panelCurve,
            });
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor for MTElementContainer.
 /// </summary>
 /// <param name="createFrom">The FrameworkElement this container is going to store touches for and manipulate.</param>
 public MTContainer(FrameworkElement createFrom, Panel topCont, ElementProperties props)
 {
     StartScale = 1f;
     Transforms = new TransformGroup();
     if (createFrom == null) throw new ArgumentNullException("createFrom must not be null");
     WorkingObject = createFrom;
     this.TopContainer = topCont;
     handler = ElementHandler.GetHandler(this.WorkingObject, topCont, this);
     ElementDef = props;
 }
Ejemplo n.º 12
0
        public void DisplayElement(int index)
        {
            try
            {
                if (elementList.Count > 0)
                {
                    ElementProperties ep = elementList[index];
                    selElementProperties     = ep;
                    m_handler.CurrentElement = selElementProperties;

                    if (!string.IsNullOrEmpty(ep.ElementName))
                    {
                        textBoxRevit.Text = ep.ElementName;
                    }
                    else
                    {
                        textBoxRevit.Text = "Element Not Found - " + ep.ElementId.ToString();
                    }

                    freezeHandler = true;
                    if (comboBoxAction.HasItems)
                    {
                        for (int i = 0; i < comboBoxAction.Items.Count; i++)
                        {
                            ColorDefinition definition = (ColorDefinition)comboBoxAction.Items[i];
                            if (definition.ParameterValue == selElementProperties.Action)
                            {
                                comboBoxAction.SelectedIndex = i; break;
                            }
                        }
                    }

                    if (comboBoxResponsible.HasItems)
                    {
                        for (int i = 0; i < comboBoxResponsible.Items.Count; i++)
                        {
                            ColorDefinition definition = (ColorDefinition)comboBoxResponsible.Items[i];
                            if (definition.ParameterValue == selElementProperties.ResponsibleParty)
                            {
                                comboBoxResponsible.SelectedIndex = i; break;
                            }
                        }
                    }
                    freezeHandler = false;
                }
                else if (elementList.Count == 0)
                {
                    textBoxRevit.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to display the current element.\n" + ex.Message, "Display Element", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
 private void Init(XmlWriterSettings settings)
 {
     if (elementPropertySearch == null)
     {
         attributePropertySearch = new TernaryTreeReadOnly(HtmlTernaryTree.htmlAttributes);
         elementPropertySearch = new TernaryTreeReadOnly(HtmlTernaryTree.htmlElements);
     }
     this.elementScope = new ByteStack(10);
     this.uriEscapingBuffer = new byte[5];
     this.currentElementProperties = ElementProperties.DEFAULT;
     this.mediaType = settings.MediaType;
 }
Ejemplo n.º 14
0
        protected void ElementSelected(object controller, ElementEventArgs args)
        {
            elementProperties = null;

            if (args.Element != null)
            {
                elementProperties = args.Element.CreateProperties();
            }

            pgElement.SelectedObject = elementProperties;
            canvasController.Canvas.Focus();
        }
Ejemplo n.º 15
0
 private void Init(XmlWriterSettings settings)
 {
     if (elementPropertySearch == null)
     {
         attributePropertySearch = new TernaryTreeReadOnly(HtmlTernaryTree.htmlAttributes);
         elementPropertySearch   = new TernaryTreeReadOnly(HtmlTernaryTree.htmlElements);
     }
     this.elementScope             = new ByteStack(10);
     this.uriEscapingBuffer        = new byte[5];
     this.currentElementProperties = ElementProperties.DEFAULT;
     this.mediaType = settings.MediaType;
 }
        public void ElementProperties_DeriveName()
        {
            Dictionary <string, string> properties = new Dictionary <string, string>()
            {
                { ControlKeys.Type, ControlType.Button.ControlTypeToString() },
                { ControlKeys.Name, "OkButton" }
            };

            ElementProperties element = new ElementProperties(properties);

            Assert.AreEqual("OkButton", element.DerivedName);
        }
Ejemplo n.º 17
0
        private static TestObjectNurse BuildTestObjectsHierarchy(List <AutomationElement> ancestorElements,
                                                                 BreadcrumbControl breadcrumbControl,
                                                                 LAPListViewControl listView,
                                                                 Bitmap bmpDeskTop
                                                                 )
        {
            int ancestorCount            = ancestorElements.Count;
            int breadcrumbCount          = breadcrumbControl.Count;
            int indexOfAutomationElement = 0;

            UIATestObject   topTestObject      = UIAUtility.CreateTestObject(ancestorElements[0]);
            TestObjectNurse topNurseObject     = new TestObjectNurse(topTestObject);
            TestObjectNurse currentNurseObject = topNurseObject;

            if (ancestorCount > breadcrumbCount)
            {
                for (indexOfAutomationElement = 1; indexOfAutomationElement < ancestorCount && breadcrumbCount < ancestorCount - indexOfAutomationElement; ++indexOfAutomationElement)
                {
                    AutomationElement element = ancestorElements[indexOfAutomationElement];
                    if (!string.IsNullOrEmpty(element.Current.Name))
                    {
                        UIATestObject childTestObject = UIAUtility.CreateTestObject(element);
                        currentNurseObject = (TestObjectNurse)currentNurseObject.AddChild(childTestObject);
                    }
                }
            }

            Breadcrumb[] breadcrumbs = breadcrumbControl.GetItems();
            foreach (Breadcrumb breadcrumb in breadcrumbs)
            {
                if (breadcrumb.Checked)
                {
                    UIATestObject childTestObject = UIAUtility.CreateTestObject((breadcrumb.Tag as ElementProperties).AutomationElement);
                    currentNurseObject = (TestObjectNurse)currentNurseObject.AddChild(childTestObject);
                }
            }

            ListView.CheckedListViewItemCollection selectedItems = listView.CheckedItems;

            foreach (ListViewItem item in selectedItems)
            {
                if (null == item.Tag)
                {
                    continue;
                }
                ElementProperties ep       = item.Tag as ElementProperties;
                TestObjectNurse   subNurse = ep.ToNurseObject();

                subNurse.ImageFile = SnapshotHelper.SnapshotFileFromBitmap(subNurse.TestObject, bmpDeskTop);
                currentNurseObject.AddChild(subNurse);
            }
            return(topNurseObject);
        }
Ejemplo n.º 18
0
        protected void OnElementSelected(object controller, ElementEventArgs args)
        {
            ElementProperties                elementProperties   = null;
            IFlowSharpCodeEditorService      csCodeEditorService = ServiceManager.Get <IFlowSharpCodeEditorService>();
            IFlowSharpScintillaEditorService editorService       = ServiceManager.Get <IFlowSharpScintillaEditorService>();

            if (args.Element != null)
            {
                GraphicElement el = args.Element;
                System.Diagnostics.Trace.WriteLine("*** ON ELEMENT SELECTED " + el.Id.ToString());
                elementProperties = el.CreateProperties();

                if (!String.IsNullOrEmpty(csCodeEditorService.Filename))
                {
                    // Save last position.
                    int curpos = csCodeEditorService.GetPosition();
                    fileCaretPos[csCodeEditorService.Filename] = curpos;
                    System.Diagnostics.Trace.WriteLine("*** " + csCodeEditorService.Filename + " => SET CURRENT POS: " + curpos);
                }

                string code;
                el.Json.TryGetValue("Code", out code);
                csCodeEditorService.SetText("C#", code ?? String.Empty);

                string fn = el.Id.ToString();               // Use something that is unique for this shape's code.
                System.Diagnostics.Trace.WriteLine("*** " + fn + " => SET ID");
                csCodeEditorService.Filename = fn;

                // Set the last known position if we have one.
                int pos;

                if (fileCaretPos.TryGetValue(fn, out pos))
                {
                    System.Diagnostics.Trace.WriteLine("*** " + fn + " => SET PREVIOUS POS: " + pos);
                    csCodeEditorService.SetPosition(pos);
                }
                else
                {
                    // A newly seen document, set the caret to pos 0 so the editor doesn't retain
                    // the previous scrollbar location.
                    csCodeEditorService.SetPosition(0);
                }

                el.Json.TryGetValue("python", out code);
                editorService.SetText("python", code ?? String.Empty);
            }
            else
            {
                csCodeEditorService.SetText("C#", String.Empty);
                editorService.SetText("python", String.Empty);
            }
        }
Ejemplo n.º 19
0
        private void Init(XmlWriterSettings settings)
        {
            Debug.Assert((int)ElementProperties.URI_PARENT == (int)AttributeProperties.URI);
            Debug.Assert((int)ElementProperties.BOOL_PARENT == (int)AttributeProperties.BOOLEAN);
            Debug.Assert((int)ElementProperties.NAME_PARENT == (int)AttributeProperties.NAME);

            _elementScope             = new ByteStack(StackIncrement);
            _uriEscapingBuffer        = new byte[5];
            _currentElementProperties = ElementProperties.DEFAULT;

            _mediaType = settings.MediaType;
            _doNotEscapeUriAttributes = settings.DoNotEscapeUriAttributes;
        }
Ejemplo n.º 20
0
        protected void ElementSelected(object controller, ElementEventArgs args)
        {
            elementProperties = null;

            // TODO: Get rid of this if statement by having an ElementDeselected event.
            if (args.Element != null)
            {
                elementProperties = args.Element.CreateProperties();
            }

            pgElement.SelectedObject = elementProperties;
            canvasController.Canvas.Focus();
        }
Ejemplo n.º 21
0
        protected void ElementSelected(object controller, ElementEventArgs args)
        {
            elementProperties = null;

            // TODO: Get rid of this if statement by having an ElementDeselected event.
            if (args.Element != null)
            {
                elementProperties        = args.Element.CreateProperties();
                pgElement.SelectedObject = elementProperties;
            }

            serviceManager.Get <IFlowSharpCanvasService>().ActiveController.Canvas.Focus();
        }
Ejemplo n.º 22
0
        public void AddControl(FrameworkElement frameworkElement, string applicationIdentifierToGet, Key completeScanKey)
        {
            if (frameworkElement is UIElement)
            {
                ElementProperties newProp = new ElementProperties();
                newProp.ApplicationIdentifierToGet = applicationIdentifierToGet;
                newProp.CompleteScanKey            = completeScanKey;

                Controls.Add(frameworkElement, newProp);

                //((ComboDialog)frameworkElement).PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(TextControlScannerService_PreviewTextInput);
                ((UIElement)frameworkElement).PreviewKeyDown += new KeyEventHandler(TextControlScannerService_PreviewKeyDown);
            }
        }
Ejemplo n.º 23
0
        public void UpdateSelNode(ElementProperties elementProperties, string imagePath)
        {
            TreeNode        selectNode = _treeObjects.SelectedNode;
            TestObjectNurse TONurse    = null;

            if (selectNode == null)
            {
                RaiseUpdateNodePropertyCompleteEvent(ResultType.NoSelectedNode);
                return;
            }
            if (null == (TONurse = selectNode.Tag as TestObjectNurse))
            {
                RaiseUpdateNodePropertyCompleteEvent(ResultType.NoSelectedNode);
                return;
            }

            if (!TONurse.ControlTypeString.Equals(elementProperties.ControlTypeString))
            {
                RaiseUpdateNodePropertyCompleteEvent(ResultType.NotSameControlType);
                return;
            }

            ITestObject TO = TONurse.TestObject;

            TONurse.CachedProperties.Clear();
            TONurse.ImageFile = imagePath;
            foreach (KeyValuePair <string, string> pair in elementProperties.NoneEmptyProperties)
            {
                TONurse.CachedProperties.Add(pair.Key, pair.Value);
                if (TO.Properties.ContainsKey(pair.Key))
                {
                    TO.Properties[pair.Key] = pair.Value;
                }
            }

            //foreach (KeyValuePair<string, string> pair in elementProperties.SelectedProperties)
            //{
            //    if (TO.Properties.ContainsKey(pair.Key))
            //    {
            //        TO.Properties[pair.Key] = pair.Value;
            //    }
            //}

            //TODO : temporarily convert to UIATestObject. Should use TestObjectBase or ITestObject directly
            (TO as UIATestObject).AutomationElement = elementProperties.AutomationElement;
            (TO as UIATestObject).ControlType       = elementProperties.ControlType;
            (TO as UIATestObject).NodeName          = elementProperties.DerivedName;
            TONurse.RefreshName();
            RaiseUpdateNodePropertyCompleteEvent(ResultType.OK);
        }
        public void ElementProperties_DeriveName1()
        {
            ElementProperties.ResetSeed();
            Dictionary <string, string> properties = new Dictionary <string, string>()
            {
                { UIAControlKeys.Type, ControlType.CheckBox.ControlTypeToString() },
                { UIAControlKeys.ClassName, "CalcClass" } /*any other property*/
            };

            ElementProperties element = new ElementProperties(properties);

            Assert.AreEqual("CheckBox1", element.DerivedName);
            //repeated call generates the same result
            Assert.AreEqual("CheckBox1", element.DerivedName);
        }
Ejemplo n.º 25
0
        private async Task Blink(ElementProperties sw, CancellationToken ct)
        {
            while (true)
            {
                await Task.Delay(800);

                sw.IsCandidate = sw.IsCandidate == true ? false : true;

                if (ct.IsCancellationRequested)
                {
                    sw.IsCandidate = false;
                    ct.ThrowIfCancellationRequested();
                }
            }
        }
Ejemplo n.º 26
0
 public override void WriteStartElement(string prefix, string localName, string ns)
 {
     this.elementScope.Push((byte)this.currentElementProperties);
     if (ns.Length == 0)
     {
         this.currentElementProperties = (ElementProperties)elementPropertySearch.FindCaseInsensitiveString(localName);
         base.bufBytes[base.bufPos++]  = 60;
         base.RawText(localName);
         base.attrEndPos = base.bufPos;
     }
     else
     {
         this.currentElementProperties = ElementProperties.HAS_NS;
         base.WriteStartElement(prefix, localName, ns);
     }
 }
Ejemplo n.º 27
0
 internal override void WriteFullEndElement(string prefix, string localName, string ns)
 {
     if (ns.Length == 0)
     {
         if ((this.currentElementProperties & ElementProperties.EMPTY) == ElementProperties.DEFAULT)
         {
             base.bufBytes[base.bufPos++] = 60;
             base.bufBytes[base.bufPos++] = 0x2f;
             base.RawText(localName);
             base.bufBytes[base.bufPos++] = 0x3e;
         }
     }
     else
     {
         base.WriteFullEndElement(prefix, localName, ns);
     }
     this.currentElementProperties = (ElementProperties)this.elementScope.Pop();
 }
Ejemplo n.º 28
0
 private void UpdateParameters(Document doc)
 {
     try
     {
         if (null != selectedIssue && null != selectedComment)
         {
             foreach (int elementId in selectedIssue.ElementDictionary.Keys)
             {
                 ElementProperties ep  = selectedIssue.ElementDictionary[elementId];
                 bool parameterUpdated = ParameterUtil.UpdateBCFParameters(m_doc, ep, selectedIssue, selectedComment);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed to update parameters by selected issues.\n" + ex.Message, "Update Parameters", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Ejemplo n.º 29
0
        protected void OnElementSelected(object controller, ElementEventArgs args)
        {
            ElementProperties elementProperties = null;

            if (args.Element != null)
            {
                GraphicElement el = args.Element;
                elementProperties = el.CreateProperties();

                string code;
                el.Json.TryGetValue("Code", out code);
                csCodeEditorService.SetText(code ?? String.Empty);
            }
            else
            {
                csCodeEditorService.SetText(String.Empty);
            }
        }
Ejemplo n.º 30
0
        private void comboBoxIssue_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (null != comboBoxIssue.SelectedItem)
                {
                    IssueEntry issueEntry = comboBoxIssue.SelectedItem as IssueEntry;
                    string     issueId    = issueEntry.IssueId;
                    if (null != selectedBCF)
                    {
                        selectedIssue           = bcfDictionary[selectedBCF.MarkupFileId][issueId];
                        imageIssue.Source       = selectedIssue.Snapshot;
                        labelIssueTopic.Content = selectedIssue.IssueTopic;

                        List <Comment> comments = selectedIssue.CommentDictionary.Values.ToList();
                        comments = comments.OrderBy(o => o.Comment1).ToList();

                        dataGridComments.ItemsSource = null;
                        dataGridComments.ItemsSource = comments;
                        if (comments.Count > 0)
                        {
                            dataGridComments.SelectedIndex = 0;
                        }
                    }

                    elementList = selectedIssue.ElementDictionary.Values.ToList();
                    if (isFilterOn)
                    {
                        elementList = ApplyCategoryFilter(elementList);
                    }

                    currentIndex = 0;
                    UpdateElementParameters();
                    selElementProperties = null;
                    UpdateIndex();
                    DisplayElement(currentIndex);
                    UpdateViews();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to trigger the evnet of selection changed for Issue.\n" + ex.Message, "comboBoxIssue SelectionChanged", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Ejemplo n.º 31
0
        public static object InstantiateElement(int type, ElementProperties properties)
        {
            int left   = properties.render_left;
            int top    = properties.render_top;
            int width  = properties.render_width;
            int height = properties.render_height;

            switch (type)
            {
            case 1:     // Rectangle
                Element.Rectangle rect = new Element.Rectangle();
                rect.SetColor(
                    properties.bg_red,
                    properties.bg_green,
                    properties.bg_blue,
                    properties.bg_alpha);
                return(rect);

            case 2:     // Canvas
                Element.Canvas canvas = new Element.Canvas();
                canvas.SetPosition(left, top, width, height);
                return(canvas);

            case 3:     // ScrollPanel
                Element.ScrollPanel scrollPanel = new Element.ScrollPanel();
                scrollPanel.SetPosition(left, top, width, height);
                return(scrollPanel);

            case 4:     // Button
                Element.Button button = new Element.Button();
                button.SetPosition(left, top, width, height);
                button.Text = properties.misc_string_0;
                return(button);

            case 5:     // Label
                Element.Label label = new Element.Label();
                label.Text = properties.misc_string_0;
                return(label);

            default:
                throw new NotImplementedException();
            }
        }
//
// Private methods
//

        private void Init(XmlWriterSettings settings)
        {
            Debug.Assert((int)ElementProperties.URI_PARENT == (int)AttributeProperties.URI);
            Debug.Assert((int)ElementProperties.BOOL_PARENT == (int)AttributeProperties.BOOLEAN);
            Debug.Assert((int)ElementProperties.NAME_PARENT == (int)AttributeProperties.NAME);

            if (elementPropertySearch == null)
            {
                //elementPropertySearch should be init last for the mutli thread safe situation.
                attributePropertySearch = new TernaryTreeReadOnly(HtmlTernaryTree.htmlAttributes);
                elementPropertySearch   = new TernaryTreeReadOnly(HtmlTernaryTree.htmlElements);
            }

            elementScope             = new ByteStack(StackIncrement);
            uriEscapingBuffer        = new byte[5];
            currentElementProperties = ElementProperties.DEFAULT;

            mediaType = settings.MediaType;
        }
        /// <summary>
        /// 获取父对象或者本对象的变量值
        /// </summary>
        /// <param name="varName">变量名,$开头值父对象的变量,#开头是本对象的值</param>
        /// <returns>可直接计算的数值文本形式,如0.5,223</returns>
        public string getCalculatableVariableValue(string varName)
        {
            string value, variableName = varName.Substring(1);

            if (varName[0] == '$')
            {
                if (ParentElement == null)
                {
                    throw new SynatxErrorException(-1, -1, string.Format("In element \"{0}\" ,cant get variable \"{2}\" from null parent", ElementName, varName));
                }
                if (!ParentElement.ElementProperties.ContainsKey(variableName))
                {
                    throw new SynatxErrorException(-1, -1, "cant find parent property " + variableName);
                }
                value = (string)ParentElement.ElementProperties[variableName];
                if (value.Contains("\""))
                {
                    throw new SynatxErrorException(-1, -1, string.Format("In element \"{0}\" property \"{1}\" cant be calculated", ElementName, varName));
                }
                return(value);
            }

            if (varName[0] == '#')
            {
                if (ParentElement == null)
                {
                    throw new SynatxErrorException(-1, -1, string.Format("In element \"{0}\" ,cant get variable \"{2}\" from null parent", ElementName, varName));
                }
                if (!ElementProperties.ContainsKey(variableName))
                {
                    throw new SynatxErrorException(-1, -1, "cant find parent property " + variableName);
                }
                value = (string)ElementProperties[variableName];
                if (value.Contains("\""))
                {
                    throw new SynatxErrorException(-1, -1, string.Format("In element \"{0}\" property \"{1}\" cant be calculated", ElementName, varName));
                }
                return(value);
            }

            throw new SynatxErrorException(-1, -1, "unknown synatx error!");
        }
 public override void WriteStartElement(string prefix, string localName, string ns)
 {
     this.elementScope.Push((byte) this.currentElementProperties);
     if (ns.Length == 0)
     {
         this.currentElementProperties = (ElementProperties) elementPropertySearch.FindCaseInsensitiveString(localName);
         base.bufBytes[base.bufPos++] = 60;
         base.RawText(localName);
         base.attrEndPos = base.bufPos;
     }
     else
     {
         this.currentElementProperties = ElementProperties.HAS_NS;
         base.WriteStartElement(prefix, localName, ns);
     }
 }
 internal override void WriteFullEndElement(string prefix, string localName, string ns)
 {
     if (ns.Length == 0)
     {
         if (base.trackTextContent && base.inTextContent)
         {
             base.ChangeTextContentMark(false);
         }
         if ((this.currentElementProperties & ElementProperties.EMPTY) == ElementProperties.DEFAULT)
         {
             base.bufChars[base.bufPos++] = '<';
             base.bufChars[base.bufPos++] = '/';
             base.RawText(localName);
             base.bufChars[base.bufPos++] = '>';
         }
     }
     else
     {
         base.WriteFullEndElement(prefix, localName, ns);
     }
     this.currentElementProperties = (ElementProperties) this.elementScope.Pop();
 }
Ejemplo n.º 36
0
        private void Init(XmlWriterSettings settings)
        {
            Debug.Assert((int)ElementProperties.URI_PARENT == (int)AttributeProperties.URI);
            Debug.Assert((int)ElementProperties.BOOL_PARENT == (int)AttributeProperties.BOOLEAN);
            Debug.Assert((int)ElementProperties.NAME_PARENT == (int)AttributeProperties.NAME);

            if (elementPropertySearch == null)
            {
                //elementPropertySearch should be init last for the mutli thread safe situation.
                attributePropertySearch = new TernaryTreeReadOnly(HtmlTernaryTree.htmlAttributes);
                elementPropertySearch = new TernaryTreeReadOnly(HtmlTernaryTree.htmlElements);
            }

            elementScope = new ByteStack(StackIncrement);
            _uriEscapingBuffer = new byte[5];
            currentElementProperties = ElementProperties.DEFAULT;

            _mediaType = settings.MediaType;
            _doNotEscapeUriAttributes = settings.DoNotEscapeUriAttributes;
        }
 internal override void WriteFullEndElement(string prefix, string localName, string ns)
 {
     if (ns.Length == 0)
     {
         if ((this.currentElementProperties & ElementProperties.EMPTY) == ElementProperties.DEFAULT)
         {
             base.bufBytes[base.bufPos++] = 60;
             base.bufBytes[base.bufPos++] = 0x2f;
             base.RawText(localName);
             base.bufBytes[base.bufPos++] = 0x3e;
         }
     }
     else
     {
         base.WriteFullEndElement(prefix, localName, ns);
     }
     this.currentElementProperties = (ElementProperties) this.elementScope.Pop();
 }
Ejemplo n.º 38
0
        internal override void WriteFullEndElement(string prefix, string localName, string ns)
        {
            if (ns.Length == 0)
            {
                Debug.Assert(prefix.Length == 0);



                if ((currentElementProperties & ElementProperties.EMPTY) == 0)
                {
                    bufBytes[base.bufPos++] = (byte)'<';
                    bufBytes[base.bufPos++] = (byte)'/';
                    base.RawText(localName);
                    bufBytes[base.bufPos++] = (byte)'>';
                }
            }
            else
            {
                //xml content
                base.WriteFullEndElement(prefix, localName, ns);
            }

            currentElementProperties = (ElementProperties)elementScope.Pop();
        }
Ejemplo n.º 39
0
        // For the HTML element, it should call this method with ns and prefix as String.Empty
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);

            elementScope.Push((byte)currentElementProperties);

            if (ns.Length == 0)
            {
                Debug.Assert(prefix.Length == 0);


                currentElementProperties = (ElementProperties)elementPropertySearch.FindCaseInsensitiveString(localName);
                base.bufBytes[bufPos++] = (byte)'<';
                base.RawText(localName);
                base.attrEndPos = bufPos;
            }
            else
            {
                // Since the HAS_NS has no impact to the ElementTextBlock behavior,
                // we don't need to push it into the stack.
                currentElementProperties = ElementProperties.HAS_NS;
                base.WriteStartElement(prefix, localName, ns);
            }
        }
Ejemplo n.º 40
0
        internal override void WriteFullEndElement(string prefix, string localName, string ns)
        {
            if (ns.Length == 0)
            {
                Debug.Assert(prefix.Length == 0);

                if (trackTextContent && inTextContent != false) { ChangeTextContentMark(false); }

                if ((currentElementProperties & ElementProperties.EMPTY) == 0)
                {
                    bufChars[base.bufPos++] = (char)'<';
                    bufChars[base.bufPos++] = (char)'/';
                    base.RawText(localName);
                    bufChars[base.bufPos++] = (char)'>';
                }
            }
            else
            {
                //xml content
                base.WriteFullEndElement(prefix, localName, ns);
            }

            currentElementProperties = (ElementProperties)elementScope.Pop();
        }
Ejemplo n.º 41
0
        public void Item_TouchUp(PointF p)
        {
            //절대 좌표로 변경
            PointF globalPt = new PointF(thisCont.ObjectTouches.MoveCenter.X, thisCont.ObjectTouches.MoveCenter.Y);

            if (IsSelecting == true)
            {
                IsSelecting = false;
                main.Children.Remove(fileBoxObject);

                if (fileBoxObject.fileType == "image")
                {
                    ImageView imgView = new ImageView();
                    main.Children.Add(imgView);

                    ElementProperties imgViewProp = new ElementProperties();
                    imgViewProp.ElementSupport.AddSupportForAll();

                    MTSmoothContainer imgViewCont = new MTSmoothContainer(imgView, main, imgViewProp);
                    imgViewCont.SetPosition(globalPt.X, globalPt.Y,
                        thisAngle + thisCont.RotateFilter.Target, 1.0);

                    framework.RegisterElement(imgViewCont);

                    imgView.setInit(main, window, framework, imgViewCont, thisAngle + thisCont.RotateFilter.Target, fileBoxObject.objInfo);
                }
                else if (fileBoxObject.fileType == "ppt")
                {
                    PptViewer pptViewer = new PptViewer();
                    main.Children.Add(pptViewer);

                    ElementProperties pptViewerProp = new ElementProperties();
                    pptViewerProp.ElementSupport.AddSupportForAll();

                    MTSmoothContainer pptViewerCont = new MTSmoothContainer(pptViewer, main, pptViewerProp);
                    pptViewerCont.SetPosition(globalPt.X, globalPt.Y,
                        thisAngle + thisCont.RotateFilter.Target, 1.0);

                    framework.RegisterElement(pptViewerCont);

                    pptViewer.setInit(main, window, framework, pptViewerCont, thisAngle + thisCont.RotateFilter.Target, fileBoxObject.objInfo);                
                }
                else if (fileBoxObject.fileType == "video")
                {
                    VideoControl videoCon = new VideoControl();
                    System.Windows.Shapes.Rectangle i = videoCon.SetVideo(fileBoxObject.objInfo.FilePath);

                    ElementProperties vprop = new ElementProperties();
                    vprop.ElementSupport.AddSupportForAll();

                    MTSmoothContainer cont = new MTSmoothContainer(videoCon, main, vprop);
                    cont.SetPosition(globalPt.X, globalPt.Y,
                        thisAngle + thisCont.RotateFilter.Target, 1.0);

                    framework.RegisterElement(cont);

                    main.Children.Add(videoCon);
// 
//                     cont.MaxX = (int)(this.screen_width);
//                     cont.MaxY = (int)(this.screen_height);
//                     cont.MinX = (int)(this.screen_width / 10);
//                     cont.MinY = (int)(this.screen_height / 10);
                }
                else if (fileBoxObject.fileType == "doc")
                {
                    DocViewer dv = new DocViewer();
                    
                    ElementProperties vprop = new ElementProperties();
                    vprop.ElementSupport.AddSupportForAll();

                    MTSmoothContainer cont = new MTSmoothContainer(dv, main, vprop);
                    cont.SetPosition(globalPt.X, globalPt.Y,
                        thisAngle + thisCont.RotateFilter.Target, 1.0);
                    framework.RegisterElement(cont);

                    dv.setInit(main, window, framework, cont, thisAngle + thisCont.RotateFilter.Target, fileBoxObject.objInfo);                
                
                    main.Children.Add(dv);
                    // 
                    //                     cont.MaxX = (int)(this.screen_width);
                    //                     cont.MaxY = (int)(this.screen_height);
                    //                     cont.MinX = (int)(this.screen_width / 10);
                    //                     cont.MinY = (int)(this.screen_height / 10);
                }
            }
            if (IsMoving == true)
            {
                IsMoving = false;
            }
            if (IsRotating == true)
            {
                IsRotating = false;
                firstAng = false;
            }
        }
Ejemplo n.º 42
0
 public ElementData(Bitmap img, TextureID tID, ElementProperties[] properties)
 {
     ImageData = img;
     ID = tID;
     Properties = properties;
 }
Ejemplo n.º 43
0
        public void Item_TouchUp(PointF p, string ipAddress)
        {
            //절대 좌표로 변경
            PointF globalPt = new PointF(thisCont.ObjectTouches.MoveCenter.X, thisCont.ObjectTouches.MoveCenter.Y);

            if (IsSelecting == true)
            {
                IsSelecting = false;
                main.Children.Remove(contactsObj);

                if (itemState == 1) //연락처 전송
                {
                    contactsObj.sendContact(ipAddress);
                }
                else if (itemState == 2)
                {
                }
                else
                {
                    ContactsObject cObj = new ContactsObject(window, main, contactsObj.contacts);
                    
                    ElementProperties cObjProp = new ElementProperties();
                    cObjProp.ElementSupport.AddSupportForAll();

                    MTSmoothContainer cObjCont = new MTSmoothContainer(cObj, main, cObjProp);
                    framework.RegisterElement(cObjCont);

                    cObj.setInit(framework, cObjCont);
                    
                    main.Children.Add(cObj);

                    cObjCont.SetPosition(globalPt.X, globalPt.Y, thisAngle + thisCont.RotateFilter.Target, 1.0);
                }
            }
        }
 public override void WriteStartElement(string prefix, string localName, string ns)
 {
     this.elementScope.Push((byte) this.currentElementProperties);
     if (ns.Length == 0)
     {
         if (base.trackTextContent && base.inTextContent)
         {
             base.ChangeTextContentMark(false);
         }
         this.currentElementProperties = (ElementProperties) elementPropertySearch.FindCaseInsensitiveString(localName);
         base.bufChars[base.bufPos++] = '<';
         base.RawText(localName);
         base.attrEndPos = base.bufPos;
     }
     else
     {
         this.currentElementProperties = ElementProperties.HAS_NS;
         base.WriteStartElement(prefix, localName, ns);
     }
 }