public void OpenFile(string fileDir)
        {
            try
            {
                switch (ReturnType(new FileInfo(fileDir).Extension))
                {
                case 1:
                    WinClassicNotepad np = new WinClassicNotepad();
                    np.mainText.Text   = FileDialogBoxManager.ReadTextFile(fileDir);
                    np.CurrentFilePath = fileDir;
                    WinClassic app = wm.Init(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true);

                    Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
                    break;

                case 2:
                    WinClassicWordPad wp = new WinClassicWordPad();
                    wp.mainText.LoadFile(fileDir);
                    wp.CurrentFilePath = fileDir;
                    WinClassic app2 = wm.Init(wp, "Wordpad", Properties.Resources.Win95IconWordpad, true, true);

                    Program.AddTaskbarItem(app2, app2.Tag.ToString(), "Wordpad", Properties.Resources.Win95IconWordpad);
                    break;

                case 12:
                    OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir);
                    break;
                }
            } catch {
            }
        }
Example #2
0
        public void OpenFile(string fileDir)
        {
            try
            {
                switch (ReturnType(new FileInfo(fileDir).Extension))
                {
                case 1:
                    WinClassicNotepad np = new WinClassicNotepad();
                    np.mainText.Text   = FileDialogBoxManager.ReadTextFile(fileDir);
                    np.CurrentFilePath = fileDir;
                    WinClassic app = wm.Init(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true);

                    Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
                    break;

                case 2:
                    WinClassicWordPad wp = new WinClassicWordPad();
                    wp.mainText.LoadFile(fileDir);
                    wp.CurrentFilePath = fileDir;
                    WinClassic app2 = wm.Init(wp, "Wordpad", Properties.Resources.Win95IconWordpad, true, true);

                    Program.AddTaskbarItem(app2, app2.Tag.ToString(), "Wordpad", Properties.Resources.Win95IconWordpad);
                    break;

                case 12:
                    OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir);
                    break;

                case 13:
                    WinClassicAddressBook wcab = new WinClassicAddressBook();
                    wcab.AddressBookObjects = JsonConvert.DeserializeObject <List <AddressBookContactList> >(File.ReadAllText(fileDir));

                    wcab.treeView1.Nodes.Clear();
                    wcab.treeView1.Nodes.Add("Shared Contacts");
                    foreach (AddressBookContactList lst in wcab.AddressBookObjects)
                    {
                        wcab.UpdateTreeView(lst);
                    }

                    WinClassic app3 = wm.Init(wcab, "Address Book", Properties.Resources.WinClassicAddressBook, true, true);

                    Program.AddTaskbarItem(app3, app3.Tag.ToString(), "Address Book", Properties.Resources.WinClassicAddressBook);
                    break;
                }
            }
            catch
            {
            }
        }