/// <summary> /// Displays a feedback dialog from the plugin /// </summary> /// <param name="Feedback">String message for feedback</param> /// <param name="Plugin">The plugin that called the feedback</param> public void Feedback(string Feedback, IPlugin Plugin) { //This sub makes a new feedback form and fills it out //With the appropriate information //This method can be called from the actual plugin with its Host Property System.Windows.Forms.Form newForm = null; frmFeedback newFeedbackForm = new frmFeedback(); //Here we set the frmFeedback's properties that i made custom newFeedbackForm.PluginAuthor = "By: " + Plugin.Author; newFeedbackForm.PluginDesc = Plugin.Description; newFeedbackForm.PluginName = Plugin.Name; newFeedbackForm.PluginVersion = Plugin.Version; newFeedbackForm.Feedback = Feedback; //We also made a Form object to hold the frmFeedback instance //If we were to declare if not as frmFeedback object at first, //We wouldn't have access to the properties we need on it newForm = newFeedbackForm; newForm.ShowDialog(); newFeedbackForm = null; newForm = null; }
private void HideFillClrPicker(IPlugin tool) { if (!tool.canFill) { fillColorPicker.Visibility = Visibility.Collapsed; fillTB.Visibility = Visibility.Collapsed; } else { fillColorPicker.Visibility = Visibility.Visible; fillTB.Visibility = Visibility.Visible; } }
private void toolBtn_Click(object sender, RoutedEventArgs e) { var toolItem = (ToolItem)((Button)sender).DataContext; if (toolItem != null) { var plugin = toolItem.Tool; tool = plugin.Initialize(canvas, stroke, strokeThickness, fill); propertiesGrid.Visibility = Visibility.Visible; HideFillClrPicker(tool); UpdateBtnColor(toolItem); } }
private void PluginsMenuItem_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); System.Windows.Forms.DialogResult result = folderBrowserDialog1.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { pluginsDirectory = folderBrowserDialog1.SelectedPath; InitializePlugins(); propertiesGrid.Visibility = Visibility.Hidden; toolsListView.IsEnabled = false; tool = null; } if (tools != null && tools.Count() > 0) toolsListView.Visibility = Visibility.Visible; else { toolsListView.Visibility = Visibility.Hidden; MessageBox.Show(Properties.Resources.PluginsError, Properties.Resources.Plugins); } }
public void Feedback(object info, IPlugin Plugin) { try { if (Plugin.PluginName == "CanonSearch" && info != null) { string bookName = ((string)info).Split('#')[0]; string searchWrd = ((string)info).Split('#')[1]; lastBookName = bookName; UpdatePaliViewer(Directory.GetCurrentDirectory() + @"\Work\" + bookName + ".htm", bookName, searchWrd); } else if (Plugin.PluginName == "AdjustFonts" && info != null) { if (((string)info) == "refresh") { PaliViewer pv = (PaliViewer)(Control)ReaderTabPanel.TabPages[selectedTabNo].GetNextControl(null, true); pv.refreshPage(); } } else if (Plugin.PluginName == "QuickNav" && info != null && (string)info != "") { if (((string)info).Contains("BM#")) { string bookMarkPosition = ((string)info).Split('#')[1]; Types.AvailablePlugin selectedPlugin = AvailablePlugins.Find("FavMan"); if (selectedPlugin != null) { selectedPlugin.Instance.SetPluginParameter(bookMarkPosition); this.InfoPane.SelectedIndex = 2; } } else { PaliViewer pv = (PaliViewer)(Control)ReaderTabPanel.TabPages[selectedTabNo].GetNextControl(null, true); pv.JumpToParagraph((string)info); } } else if (Plugin.PluginName == "FavMan" && info != null && (string)info != "") { string book = ((string)info).Split('\\')[0]; int l = ((string)info).Split('\\').Length; string searchWord = ((string)info).Split('\\')[l - 1]; book = PaliReaderUtils.NamingConverter.GetFileNameFromBook(book); lastBookName = book; AalekhDecoder.UnzipFromZipLibrary(book); if(!onlineMode) UpdatePaliViewer(Directory.GetCurrentDirectory() + @"\Work\" + book + ".htm", book, searchWord, true); else UpdatePaliViewer("http://tipitaka.nibbanam.com/books/" + book + ".htm", book, searchWord, true); } } catch(System.Exception ex) { ReportBugs rb = new ReportBugs(ex.ToString()); rb.ShowDialog(); } }
private void pluginMenuItem_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = sender as MenuItem; if (menuItem == null) return; if (_currentActivePlugin != null) _currentActivePlugin.Dispose(); IPlugin plugin = menuItem.Tag as IPlugin; if (plugin != null) { _currentActivePlugin = plugin; _currentActivePlugin.Initialize(v_Canvas, _currentColor, _currentThickness); } }
public void Feedback(Tool.BasicTools Feedback, IPlugin Plugin) { // Do not remoove !!!! #region Tool creation and setting tool data Main switch switch (Feedback) { case Tool.BasicTools.BackGroundColorButton: { Plugin.BackgroundColor = (new ColorDialogManager()).BackGroundColor; Plugin.MainInterface.Invalidate(true); } break; case Tool.BasicTools.ForeGroundColorButton: { Plugin.ForegroundColor = (new ColorDialogManager()).ForeGroundColor; Plugin.MainInterface.Invalidate(true); } break; case Tool.BasicTools.Pencil: { CreateTool(new MyTools.PencilTool()); (new DialogManger.DialogToolManager()).Show(); } break; case Tool.BasicTools.MouseCursor: { CreateTool(new MyTools.BaseTool()); } break; case Tool.BasicTools.Text: { CreateTool(new MyTools.TextTool()); (new DialogManger.DialogToolManager()).Show(); } break; case Tool.BasicTools.Brush: { CreateTool(new MyTools.BrushTool()); (new DialogManger.DialogToolManager()).Show(); } break; case Tool.BasicTools.Eraser: { CreateTool(new MyTools.EraserTool()); } break; case Tool.BasicTools.ColorPick: { CreateTool(new MyTools.ColorPickTool()); } break; case Tool.BasicTools.Zoom: { CreateTool(new MyTools.ZoomTool()); } break; case Tool.BasicTools.Bucket: { CreateTool(new MyTools.BucketTool()); } break; case Tool.BasicTools.RectangleSelection: { CreateTool(new MyTools.RectangleSelectionTool()); } break; default: { CreateTool(new MyTools.BaseTool()); } break; } #endregion }