internal void Update(grammarRule rule, ruleWindow rW)
 {
     this.rule          = rule;
     ruleWin            = rW;
     ShapeRulePrpt.rule = rule;
     Update();
 }
 public void NewGrammarRule_ClickOnExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     try
     {
         ///
         /// a temporary fix until we phase out UI.UICanvas
         var canvas = TemplatePickerWindow.ShowWindowDialog();
         if (canvas == null)
         {
             canvas = new CanvasProperty();
         }
         var rW = new ruleWindow(canvas);
         windowsMgr.AddandShowWindow(rW);
     }
     catch (Exception exc)
     {
         ErrorLogger.Catch(exc);
     }
 }
Exemple #3
0
        public void addAndShowRuleWindow(object obj, string title = null)
        {
            var    gR       = new grammarRule();
            var    canvas   = new CanvasProperty();
            string filename = null;

            if (obj == null)
            {
                gR = null;
            }
            else if (obj is grammarRule)
            {
                gR = (grammarRule)obj;
            }
            else if (obj is object[])
            {
                var objArray = (object[])obj;
                if (objArray.GetLength(0) > 0)
                {
                    if (objArray[0] is grammarRule)
                    {
                        gR = (grammarRule)objArray[0];
                    }
                    else if (objArray[0] is CanvasProperty)
                    {
                        canvas = (CanvasProperty)objArray[0];
                    }
                    else if (objArray[0] is string)
                    {
                        filename = (string)objArray[0];
                    }
                }
                if (objArray.GetLength(0) > 1)
                {
                    if (objArray[1] is grammarRule)
                    {
                        gR = (grammarRule)objArray[1];
                    }
                    else if (objArray[1] is CanvasProperty)
                    {
                        canvas = (CanvasProperty)objArray[1];
                    }
                    else if (objArray[1] is string)
                    {
                        filename = (string)objArray[1];
                    }
                }
                if (objArray.GetLength(0) > 2)
                {
                    if (objArray[2] is grammarRule)
                    {
                        gR = (grammarRule)objArray[2];
                    }
                    else if (objArray[2] is CanvasProperty)
                    {
                        canvas = (CanvasProperty)objArray[2];
                    }
                    else if (objArray[2] is string)
                    {
                        filename = (string)objArray[2];
                    }
                }
            }
            if (!windowsMgr.FindAndFocusFileInCollection(filename, WindowType.Rule))
            {
                var rW = new ruleWindow(gR, canvas, filename, title);
                windowsMgr.AddandShowWindow(rW);
            }
        }