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()"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { DOMHierarchy dOMHierarchy = new DOMHierarchy(); XmlDocument xmlDocument = new XmlDocument(); string path = winForms.Application.StartupPath + @"\\DOM.html"; string text = "<html></html>"; File.WriteAllText(path, text); DomHierarchyTree.Nodes.Clear(); xmlDocument.Load(path); dOMHierarchy.LoadTreeViewFromXmlDoc(xmlDocument, DomHierarchyTree); }
private void generateDOM_Click(object sender, RoutedEventArgs e) { DOMHierarchy dOM = new DOMHierarchy(); dOM.generate(htmlTextBox, DomHierarchyTree); }