private void LoadExistingBooks()
 {
     try
     {
         foreach (string file in Directory.GetFiles(Directory.GetCurrentDirectory() + @"\Work"))
         {
             FileInfo fileOn = new FileInfo(file);
             if (fileOn.Extension.Equals(".htm") && !fileOn.Name.StartsWith("welcome"))
             {
                 UpdatePaliViewer(fileOn.FullName, fileOn.Name);
             }
             else if (fileOn.Extension.Equals(".html") && !fileOn.Name.StartsWith("welcome"))
             {
                 UpdatePaliViewer(fileOn.FullName, fileOn.Name);
             }
             SplashScreen.SetReferencePoint();
         }
     }
     catch(System.Exception ex)
     {
         ReportBugs rb = new ReportBugs(ex.ToString());
         rb.StartPosition = FormStartPosition.CenterParent;
         rb.ShowDialog();
     }
 }
 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();
     }
 }
 public static void Main(string[] args)
 {
     SplashScreen.ShowSplashScreen();
     Application.EnableVisualStyles();
     Application.DoEvents();
     SplashScreen.SetStatus("Starting Pali Text Reader v. " + APP_VERSION);
     Thread.Sleep(100);
     SplashScreen.SetStatus("developed by Lopin, Holloway, Snow, Genaud, Bure et al.");
     Thread.Sleep(100);
     try
     {
         Application.Run(new Workbench());
         SplashScreen.SetReferencePoint();
     }
     catch(System.Exception ex)
     {
         //SplashScreen.CloseForm();
         ReportBugs rb = new ReportBugs(ex.ToString());
         rb.ShowDialog();
         Application.Exit();
         //MessageBox.Show(ex.Message.ToString());
     }
 }
        /// <summary>
        /// Look for plugins and load all you find
        ///	then register plugins for display in pluginviewer
        ///	Call the find plugins routine, to search in our Plugins Folder
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void WorkbenchLoad(object sender, System.EventArgs e)
        {
            try
            {
                FindPlugins(Application.StartupPath + @"\Plugins");
                availablePlugins = new Hashtable();

                foreach (Types.AvailablePlugin pluginOn in AvailablePlugins)
                {
                    SplashScreen.SetStatus("Loading Plugin: " + pluginOn.Instance.DisplayName);
                    ArrayList a = new ArrayList();
                    a.Add(pluginOn.Instance.Author);
                    a.Add(pluginOn.Instance.Version);
                    a.Add(pluginOn.Instance.Description);
                    a.Add(pluginOn.Instance.DisplayName);
                    availablePlugins.Add(pluginOn.Instance.PluginName, a);
                    SplashScreen.SetReferencePoint();
                    Thread.Sleep(10);
                }
                OpenWelcomePage();
                LoadExistingBooks();
                SplashScreen.SetStatus("Pali Text Reader successfully initialized");
                SplashScreen.CloseForm();
                ba = new BCAccessor();
                statusBarInfo.Text = "B.E. " + ba.GetBuddhistYear();
                initProperties();
                statusTimer.Start();
                this.WorkBenchToolBar.Update();
            }
            catch(System.Exception ex)
            {
                ReportBugs rb = new ReportBugs("An error occured: " + ex.ToString());
                rb.ShowDialog();
                Close();
            }
        }
 /// <summary>
 /// If user clicks on toolbar button
 /// the plugin's form will be activated
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ToolbarClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
 {
     try
     {
         if(e.Button.Text == DisplayName)
         {
             readCurrentStyleSheet();
                 //HACK done to rewrite image url on first load
                 setImageProperty(getImageProperty());
             loadCurrentBackgroundImage();
             loadCurrentFontSizes();
             loadCurrentFontColor();
             this.StartPosition = FormStartPosition.CenterParent;
             this.ShowDialog();
             this.Host.StatusBarText("AdjustFonts activated");
         }
     }
     catch(System.Exception ex)
     {
         ReportBugs rb = new ReportBugs(ex.ToString());
         rb.ShowDialog();
     }
 }
 public static void Main(string[] args)
 {
     try
     {
         Application.Run(new AdjustFonts());
     }
     catch(System.Exception ex)
     {
         ReportBugs rb = new ReportBugs(ex.ToString());
         rb.ShowDialog();
     }
 }