Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                VisualDocumentEditor vde = new VisualDocumentEditor(_Path, true);
                vde.ShowDialog();

                doc_panel.Controls.Clear();

                using (System.IO.StreamReader sr = new System.IO.StreamReader(_Path))
                {
                    richTextBox1.Text = sr.ReadToEnd();
                    sr.Close();
                }

                Run();
            }
            catch (Exception)
            {
                Message msg = new Message("Ninponix Office 2017", "Could not start the thread. Please try again", MessageIcon.MessageIconType.Error, MessageIcon.MessageMode.NVL);
                msg.ShowDialog();
            }
        }
Beispiel #2
0
        private void create_button_Click(object sender, EventArgs e)
        {
            //Check for the existence of the directory before continue
            if (System.IO.Directory.Exists(document_url.SelectedText) == false)
            {
                if (MessageBox.Show("The directory \"" + document_url.SelectedText + "\" does not exist. Do you want to create it now?", "Ninponix Office", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    //Execution 1
                    try
                    {
                        System.IO.Directory.CreateDirectory(document_url.SelectedText);
                    }
                    catch (Exception)
                    {
                        Message msg = new Message("Ninponix Office", "Couldn't create the directory for you.", MessageIcon.MessageIconType.Error, MessageIcon.MessageMode.NVL);
                        msg.ShowDialog();
                    }
                    try
                    {
                        switch (template_title.Text)
                        {
                        case "Document":
                            if (document_url.SelectedText.EndsWith("\\") == true)
                            {
                                System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Empty.nvldoc", document_url.SelectedText + document_name.Text + ".nvldoc", true);
                            }
                            else
                            {
                                System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Empty.nvldoc", document_url.SelectedText + "\\" + document_name.Text + ".nvldoc", true);
                            }

                            break;

                        case "Letter":
                            if (document_url.SelectedText.EndsWith("\\") == true)
                            {
                                System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Letter.nvldoc", document_url.SelectedText + document_name.Text + ".nvldoc", true);
                            }
                            else
                            {
                                System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Letter.snvldoc", document_url.SelectedText + "\\" + document_name.Text + ".nvldoc", true);
                            }
                            break;

                        case "Resume":
                            if (document_url.SelectedText.EndsWith("\\") == true)
                            {
                                System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Resume.nvldoc", document_url.SelectedText + document_name.Text + ".nvldoc", true);
                            }
                            else
                            {
                                System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Resume.snvldoc", document_url.SelectedText + "\\" + document_name.Text + ".nvldoc", true);
                            }
                            break;

                        case "Report":
                            if (document_url.SelectedText.EndsWith("\\") == true)
                            {
                                System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Report.nvldoc", document_url.SelectedText + document_name.Text + ".nvldoc", true);
                            }
                            else
                            {
                                System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Report.snvldoc", document_url.SelectedText + "\\" + document_name.Text + ".nvldoc", true);
                            }
                            break;
                        }
                        if (document_url.SelectedText.EndsWith("\\") == true)
                        {
                            VisualDocumentEditor edit = new VisualDocumentEditor(document_url.SelectedText + document_name.Text.ToString() + ".nvldoc", false);
                            edit.Show();
                            button1.Enabled = false;
                            open            = false;
                            showform        = false;
                        }
                        else
                        {
                            VisualDocumentEditor edit = new VisualDocumentEditor(document_url.SelectedText + "\\" + document_name.Text.ToString() + ".nvldoc", false);
                            edit.Show();
                            button1.Enabled = false;
                            open            = false;
                            showform        = false;
                        }
                    }
                    catch (Exception)
                    {
                        Message msg = new Message("Ninponix Office", "Cannot create the instance for the new document template.", MessageIcon.MessageIconType.Error, MessageIcon.MessageMode.NVL);
                        msg.ShowDialog();
                    }
                }
            }
            else
            {
                //Execution 1: on the existence dialog
                try
                {
                    System.IO.Directory.CreateDirectory(document_url.SelectedText);
                }
                catch (Exception)
                {
                    Message msg = new Message("Ninponix Office", "Couldn't create the directory for you.", MessageIcon.MessageIconType.Error, MessageIcon.MessageMode.NVL);
                    msg.ShowDialog();
                }
                try
                {
                    switch (template_title.Text)
                    {
                    case "Document":
                        if (document_url.SelectedText.EndsWith("\\") == true)
                        {
                            System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Empty.nvldoc", document_url.SelectedText + document_name.Text + ".nvldoc", true);
                        }
                        else
                        {
                            System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Empty.nvldoc", document_url.SelectedText + "\\" + document_name.Text + ".nvldoc", true);
                        }

                        break;

                    case "Letter":
                        if (document_url.SelectedText.EndsWith("\\") == true)
                        {
                            System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Letter.nvldoc", document_url.SelectedText + document_name.Text + ".nvldoc", true);
                        }
                        else
                        {
                            System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Letter.snvldoc", document_url.SelectedText + "\\" + document_name.Text + ".nvldoc", true);
                        }
                        break;

                    case "Resume":
                        if (document_url.SelectedText.EndsWith("\\") == true)
                        {
                            System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Resume.nvldoc", document_url.SelectedText + document_name.Text + ".nvldoc", true);
                        }
                        else
                        {
                            System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Resume.snvldoc", document_url.SelectedText + "\\" + document_name.Text + ".nvldoc", true);
                        }
                        break;

                    case "Report":
                        if (document_url.SelectedText.EndsWith("\\") == true)
                        {
                            System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Report.nvldoc", document_url.SelectedText + document_name.Text + ".nvldoc", true);
                        }
                        else
                        {
                            System.IO.File.Copy(Application.ExecutablePath.Replace("Ninponix Office.exe", "") + "OfficeData\\Templates\\NVL\\Documents\\Report.snvldoc", document_url.SelectedText + "\\" + document_name.Text + ".nvldoc", true);
                        }
                        break;
                    }
                    if (document_url.SelectedText.EndsWith("\\") == true)
                    {
                        VisualDocumentEditor edit = new VisualDocumentEditor(document_url.SelectedText + document_name.Text.ToString() + ".nvldoc", false);
                        edit.Show();
                        open     = false;
                        showform = false;
                    }
                    else
                    {
                        VisualDocumentEditor edit = new VisualDocumentEditor(document_url.SelectedText + "\\" + document_name.Text.ToString() + ".nvldoc", false);
                        edit.Show();
                        open     = false;
                        showform = false;
                    }
                }
                catch (Exception)
                {
                    Message msg = new Message("Ninponix Office", "Cannot create the instance for the new document template.", MessageIcon.MessageIconType.Error, MessageIcon.MessageMode.NVL);
                    msg.ShowDialog();
                }
            }
        }
Beispiel #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //PROGRAM START
            Properties.Settings.Default.Reset();
            Properties.Settings.Default.StartCount++;
            Properties.Settings.Default.Save();

            //Check for Command Line Arguments

            if (Environment.GetCommandLineArgs().Count() != 1)
            {
                string Arg  = "";
                string Path = "";
                string Type;
                int    counter = 0;

                foreach (var line in Environment.GetCommandLineArgs())
                {
                    counter++;
                    if (counter != 1)
                    {
                        if (line.EndsWith(" "))
                        {
                            Arg += line;
                        }
                        else
                        {
                            Arg += line + " ";
                        }
                    }
                }

                Path = Arg.ToString();
                Path = Path.Remove(Path.Count() - 1, 1);

                if (Path.EndsWith(" -edit"))
                {
                    string newstring = Path.Remove(Path.Length - 6, 6);

                    if (newstring.EndsWith(".nvldoc") | newstring.EndsWith(".nvlexp"))
                    {
                        if (Properties.Settings.Default.StartCount % 10 == 1)
                        {
                            Notification info = new Notification(Notification.NotificationMode.OrangeMode, @"Documentation\index.html", "Ninponix Office 2017", "Welcome to Ninponix Office 2017. Get started with Ninponix Office 2017...");
                            info.Show();
                        }
                        //NVL Editing Option
                        VisualDocumentEditor vde = new VisualDocumentEditor(newstring, true);
                        Application.Run(vde);
                    }
                    else if (newstring.EndsWith(".nopres"))
                    {
                        if (Properties.Settings.Default.StartCount % 10 == 1)
                        {
                            Notification info = new Notification(Notification.NotificationMode.GreenMode, @"Documentation\index.html", "Ninponix Office 2017", "Welcome to Ninponix Office 2017. Get started with Ninponix Office 2017...");
                            info.Show();
                        }
                        //NVL Editing Option
                        Presentation_Editor pre = new Presentation_Editor(newstring);
                        Application.Run(pre);
                    }
                }
                else
                {
                    if (Path.EndsWith(".html") | Path.EndsWith(".htm"))
                    {
                        Type = "HTML Document";
                    }
                    else if (Path.EndsWith(".txt") | Path.EndsWith(".txt"))
                    {
                        if (Properties.Settings.Default.StartCount % 10 == 1)
                        {
                            Notification info = new Notification(Notification.NotificationMode.BlueMode, @"Documentation\index.html", "Ninponix Office 2017", "Welcome to Ninponix Office 2017. Get started with Ninponix Office 2017...");
                            info.Show();
                        }
                        Type = "Text Document";
                        txtDocument myform = new txtDocument();

                        myform.docloc = Path;
                        int expands = Path.Split('\\').Count();

                        myform.doctitle   = Path.Split('\\')[expands - 1];
                        myform.title.Text = myform.doctitle;

                        using (System.IO.StreamReader sr = new System.IO.StreamReader(Path))
                        {
                            myform.textBox1.Text = sr.ReadToEnd();
                        }

                        Application.Run(myform);
                        Properties.Settings.Default.TextDocumentsThreadCount = 0;
                    }
                    else if (Path.EndsWith(".nvldoc") | Path.EndsWith(".nvlexp"))
                    {
                        if (Properties.Settings.Default.StartCount % 10 == 1)
                        {
                            Notification info = new Notification(Notification.NotificationMode.OrangeMode, @"Documentation\index.html", "Ninponix Office 2017", "Welcome to Ninponix Office 2017. Get started with Ninponix Office 2017...");
                            info.Show();
                        }
                        Type = "NVL Visual Document";
                        VisualDocumentToolBox.VDReader vd = new VisualDocumentToolBox.VDReader(Path.ToString(), false);
                        Application.Run(vd);
                    }
                    else if (Path.EndsWith(".nvl"))
                    {
                        Type = "NVL Document";
                    }
                    else if (Path.EndsWith(".nopres"))
                    {
                        if (Properties.Settings.Default.StartCount % 10 == 1)
                        {
                            Notification info = new Notification(Notification.NotificationMode.GreenMode, @"Documentation\index.html", "Ninponix Office 2017", "Welcome to Ninponix Office 2017. Get started with Ninponix Office 2017...");
                            info.Show();
                        }
                        Type = "Ninponix Office Presentation";
                        //PRESENTATION PREVIEW WINDOWS MUST BE SHOWN
                        Ninponix_Office.PresentationToolBox.PresentationViewer pre = new Ninponix_Office.PresentationToolBox.PresentationViewer();
                        pre._URL = Path;
                        Application.Run(pre);
                    }
                    else if (Path.EndsWith(".nospread"))
                    {
                        Type = "Ninponix Office Spreadsheet";
                    }
                    else if (Path.EndsWith(".rtf"))
                    {
                        Type = "Rich Text Document";
                    }
                    else
                    {
                        MessageBox.Show("The file format is not supported by the Ninponix Office", "Ninponix Office 2017", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                Application.Run(new Form1());
            }
        }