Beispiel #1
0
 private void WindowKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == Key.S && Keyboard.Modifiers == ModifierKeys.Control)
     {
         int result = fs.SaveProject(htmlTextBox, csstextBox);
         if (result == 1 || result == 2)
         {
             SaveProject.IsEnabled = false;
         }
     }
     else if (e.Key == Key.O && Keyboard.Modifiers == ModifierKeys.Control)
     {
         fs.OpenProject(htmlTextBox, csstextBox, SaveProject, MainWindowBrowser);
     }
     else if (e.Key == Key.N && Keyboard.Modifiers == ModifierKeys.Control)
     {
         fs.NewProject(htmlTextBox, csstextBox, SaveProject, this);
     }
     else if (e.Key == Key.F && Keyboard.Modifiers == ModifierKeys.Control)
     {
         FindAndReplaceDialog dialog = new FindAndReplaceDialog(htmlTextBox, csstextBox);
         dialog.ShowDialog();
     }
     else if (e.Key == Key.D && Keyboard.Modifiers == ModifierKeys.Control)
     {
         DOMHierarchy dOM = new DOMHierarchy();
         dOM.generate(htmlTextBox, DomHierarchyTree);
     }
     else if (e.Key == Key.C && Keyboard.Modifiers == ModifierKeys.Control)
     {
         IFrame copyFrame = MainWindowBrowser.GetMainFrame();
         copyFrame.ExecuteJavaScriptAsync("copyAllElements()");
     }
     else if (e.Key == Key.V && Keyboard.Modifiers == ModifierKeys.Control && !isPressed)
     {
         isPressed = true;
         if (EditProperties.copycheck)
         {
             var    clipboarddata = System.Windows.Clipboard.GetText();
             IFrame frame         = MainWindowBrowser.GetMainFrame();
             frame.ExecuteJavaScriptAsync(String.Format("pasteAllElements(`{0}`)", clipboarddata));
             EditProperties.copycheck = false;
         }
         else
         {
             winForms.MessageBox.Show("Please select an element to paste", "Element Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else if (e.Key == Key.A && Keyboard.Modifiers == ModifierKeys.Control)
     {
         IFrame selectFrame = MainWindowBrowser.GetMainFrame();
         selectFrame.ExecuteJavaScriptAsync("selectAllElements()");
     }
     else if (e.Key == Key.Delete)
     {
         IFrame deleteFrame = MainWindowBrowser.GetMainFrame();
         deleteFrame.ExecuteJavaScriptAsync("deleteAllElements()");
     }
 }
Beispiel #2
0
        /*private void cssPropertyBox_FontWeight_SelectionChanged(object sender, SelectionChangedEventArgs e)
         * {
         *  String propertyName = "FontWeight";
         *  string propertyContent = FontWeights.SelectedItem.Content.ToString();
         *  winForms.MessageBox.Show(propertyName + " has value " + propertyContent);
         *
         *  IFrame cssPropertyBoxFrame = MainWindowBrowser.GetMainFrame();
         *  cssPropertyBoxFrame.ExecuteJavaScriptAsync("getIDofSelectedElements()");
         *
         *  System.Threading.Thread.Sleep(10);
         *
         *  cpb.changeComboBox(propertyContent.ToLower(), propertyName, DragnDrop.idHolder);
         * }*/

        private void cssPropertyBox_FontStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            String propertyName    = "FontStyle";
            string propertyContent = FontStyle.SelectedItem.ToString();

            IFrame cssPropertyBoxFrame = MainWindowBrowser.GetMainFrame();

            cssPropertyBoxFrame.ExecuteJavaScriptAsync("getIDofSelectedElements()");

            System.Threading.Thread.Sleep(10);

            cpb.changeComboBox(propertyContent.ToLower(), propertyName, DragnDrop.idHolder);
        }
Beispiel #3
0
        //CSS PropertyBox Combo Selection
        private void cssPropertyBox_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            String propertyName = ((System.Windows.Controls.ComboBox)sender).Name;

            System.Windows.Controls.ComboBox cmb = sender as System.Windows.Controls.ComboBox;
            string propertyContent = ((ComboBoxItem)cmb.SelectedItem).Content as string;

            IFrame cssPropertyBoxFrame = MainWindowBrowser.GetMainFrame();

            cssPropertyBoxFrame.ExecuteJavaScriptAsync("getIDofSelectedElements()");

            System.Threading.Thread.Sleep(10);

            cpb.changeComboBox(propertyContent.ToLower(), propertyName, DragnDrop.idHolder);
        }
Beispiel #4
0
        private void BackgroundColor_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs <System.Windows.Media.Color> e)
        {
            String colorValue = e.NewValue.ToString();
            String temp       = colorValue.Substring(0, 1);
            String temp2      = colorValue.Substring(3);

            colorValue = temp + "" + temp2;

            IFrame cssPropertyBoxFrame = MainWindowBrowser.GetMainFrame();

            cssPropertyBoxFrame.ExecuteJavaScriptAsync("getIDofSelectedElements()");

            System.Threading.Thread.Sleep(10);

            cpb.changeColor(colorValue, "BackgroundColor", DragnDrop.idHolder);
        }
Beispiel #5
0
        /*private void OnBrowserJavascriptMessageReceived(object sender, JavascriptMessageReceivedEventArgs e)
         * {
         *  //Complext objects are initially expresses as IDicionary
         *  //You can use dynamic to access properties (the IDicionary is an ExpandoObject)
         *  //dynamic msg = e.Message;
         *  //Alternatively you can use the built in Model Binder to convert to a custom model
         *  var msg = e.ConvertMessageTo<String>();
         *  var callback = msg.k;
         *
         *  //Call a javascript function with your response data
         *  callback.ExecuteAsync(type);
         * }*/
        /*
         *      public void Testing()
         *      {
         *          String htmlH = htmlTextBox.Text;
         *          winForms.MessageBox.Show(htmlH);
         *          //MainWindowBrowser.ExecuteScriptAsync(String.Format("testFunc('{0}');", htmlH));
         *          IFrame frame = MainWindowBrowser.GetMainFrame();
         *          frame.ExecuteJavaScriptAsync(String.Format("testFunc(`{0}`)", htmlH));
         *      }*/
        public void assistant_Idled(object sender, EventArgs e)
        {
            Action action = delegate {
                if (dnd.setChange)
                {
                    Regex  singlelinepattern = new Regex(@"\s*?(\r\n|\n|\r)\s*");
                    String htmlH             = htmlTextBox.Text;
                    String singleLineString  = singlelinepattern.Replace(htmlH, "");
                    //winForms.MessageBox.Show(singleLineString);
                    IFrame frame = MainWindowBrowser.GetMainFrame();
                    frame.ExecuteJavaScriptAsync(String.Format("testFunc(`{0}`)", htmlH));
                }
                else
                {
                    dnd.setChange = true;
                }
            };

            this.Invoke(action);
        }
Beispiel #6
0
        private void laptopView_Click(object sender, RoutedEventArgs e)
        {
            IFrame mobileFrame = MainWindowBrowser.GetMainFrame();

            mobileFrame.ExecuteJavaScriptAsync("laptopview()");
        }
Beispiel #7
0
        public void cssPropertyBoxTypeAssistant_Idled(object sender, EventArgs e)
        {
            Action action = delegate {
                String textBoxName  = cssPropertyBoxTypeAssistant.boxName;
                String textBoxValue = cssPropertyBoxTypeAssistant.boxValue;

                IFrame cssPropertyBoxFrame = MainWindowBrowser.GetMainFrame();
                cssPropertyBoxFrame.ExecuteJavaScriptAsync("getIDofSelectedElements()");

                System.Threading.Thread.Sleep(10);
                //Column Set;
                if ((textBoxName.Equals("ColumnXS") || textBoxName.Equals("ColumnSM") || textBoxName.Equals("ColumnMD") || textBoxName.Equals("ColumnLG")) && !textBoxValue.Trim().Equals(""))
                {
                    var isNumeric = int.TryParse(textBoxValue, out int n);
                    Console.WriteLine("is Numeric is " + isNumeric);

                    if (isNumeric)
                    {
                        cpb.setColumns(Int32.Parse(textBoxValue), textBoxName, DragnDrop.idHolder);
                    }
                    else
                    {
                        winForms.MessageBox.Show("Please enter an integer", "Integer Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                //Width and Height Set
                else if ((textBoxName.Equals("WidthProperty") || textBoxName.Equals("HeightProperty")) && !textBoxValue.Trim().Equals(""))
                {
                    var isNumeric = int.TryParse(textBoxValue, out int n);
                    Console.WriteLine("is Numeric is " + isNumeric);

                    if (isNumeric)
                    {
                        cpb.changeSize(Int32.Parse(textBoxValue), textBoxName, DragnDrop.idHolder);
                    }
                    else
                    {
                        winForms.MessageBox.Show("Please enter an integer", "Integer Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                //Border Size
                else if ((textBoxName.Equals("BorderSize")) && !textBoxValue.Trim().Equals(""))
                {
                    var isNumeric = int.TryParse(textBoxValue, out int n);
                    Console.WriteLine("is Numeric is " + isNumeric);

                    if (isNumeric)
                    {
                        cpb.changeBorder(textBoxValue, textBoxName, DragnDrop.idHolder);
                    }
                    else
                    {
                        winForms.MessageBox.Show("Please enter an integer", "Integer Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if ((textBoxName.Equals("FontSize")) && !textBoxValue.Trim().Equals(""))
                {
                    var isNumeric = int.TryParse(textBoxValue, out int n);
                    Console.WriteLine("is Numeric is " + isNumeric);

                    if (isNumeric)
                    {
                        cpb.changeFont(Int32.Parse(textBoxValue), textBoxName, DragnDrop.idHolder);
                    }
                    else
                    {
                        winForms.MessageBox.Show("Please enter an integer", "Integer Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                //Padding Set
                else if ((textBoxName.Equals("TopPadding") || textBoxName.Equals("BottomPadding") || textBoxName.Equals("LeftPadding") || textBoxName.Equals("RightPadding")) && !textBoxValue.Trim().Equals(""))
                {
                    var isNumeric = int.TryParse(textBoxValue, out int n);
                    Console.WriteLine("is Numeric is " + isNumeric);

                    if (isNumeric)
                    {
                        cpb.changePadding(Int32.Parse(textBoxValue), textBoxName, DragnDrop.idHolder);
                    }
                    else
                    {
                        winForms.MessageBox.Show("Please enter an integer", "Integer Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                //Margin Set
                else if ((textBoxName.Equals("TopMargin") || textBoxName.Equals("BottomMargin") || textBoxName.Equals("LeftMargin") || textBoxName.Equals("RightMargin")) && !textBoxValue.Trim().Equals(""))
                {
                    var isNumeric = int.TryParse(textBoxValue, out int n);
                    Console.WriteLine("is Numeric is " + isNumeric);

                    if (isNumeric)
                    {
                        cpb.changeMargin(Int32.Parse(textBoxValue), textBoxName, DragnDrop.idHolder);
                    }
                    else
                    {
                        winForms.MessageBox.Show("Please enter an integer", "Integer Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (textBoxName.Equals("BackgroundUrl") && !textBoxValue.Trim().Equals(""))
                {
                    textBoxValue = "url(\"" + textBoxValue + "\")";
                    cpb.changeURL(textBoxValue, textBoxName, DragnDrop.idHolder);
                }
            };

            this.Invoke(action);
        }