示例#1
0
 private void NewFile(Uri uri)
 {
     ProjectController ctrler = ProjectController.NewProject(uri);
     ProjectWindow     window = new ProjectWindow(ctrler);
 }
示例#2
0
        private void _SetupMenu()
        {
            SaveProjectAction.Activated += (sender, e) => {
                controller.Save();
            };

            SaveProjectAsAction.Activated += (sender, e) => {
                FileChooserDialog fc = new FileChooserDialog("Save ToonBoom Exporter Project", (Gtk.Window)Toplevel, FileChooserAction.Save,
                                                             "Cancel", ResponseType.Cancel,
                                                             "Save", ResponseType.Accept);

                fc.SetCurrentFolder(System.IO.Directory.GetCurrentDirectory());
                FileFilter ff = new FileFilter();
                ff.AddPattern("*.tbp");
                fc.Filter = ff;

                if (fc.Run() == (int)ResponseType.Accept)
                {
                    controller.SaveAs(new Uri(fc.Filename));
                    Reinit();
                }
                fc.Destroy();
            };


            NewProjectAction.Activated += (sender, e) => {
                FileChooserDialog fc = new FileChooserDialog("Create new ToonBoom Exporter Project", (Gtk.Window)Toplevel, FileChooserAction.Save,
                                                             "Cancel", ResponseType.Cancel,
                                                             "Save", ResponseType.Accept);

                fc.SetCurrentFolder(System.IO.Directory.GetCurrentDirectory());
                FileFilter ff = new FileFilter();
                ff.AddPattern("*.tbp");
                fc.Filter = ff;

                if (fc.Run() == (int)ResponseType.Accept)
                {
                    ProjectController ctrler = ProjectController.NewProject(new Uri(fc.Filename));
                    ProjectWindow     window = new ProjectWindow(ctrler);

                    fc.Destroy();
                    Destroy();
                }
                else
                {
                    fc.Destroy();
                }
            };

            OpenProjectAction.Activated += (sender, e) => {
                Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Open existing ToonBoom Exporter Project.", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
                fc.SetCurrentFolder(System.IO.Directory.GetCurrentDirectory());
                FileFilter ff = new FileFilter();
                ff.AddPattern("*.tbp");
                fc.Filter = ff;

                if (fc.Run() == (int)ResponseType.Accept)
                {
                    ProjectController ctrler = ProjectController.LoadProject(new Uri(fc.Filename));
                    ProjectWindow     window = new ProjectWindow(ctrler);

                    fc.Destroy();
                    Destroy();
                }
                else
                {
                    fc.Destroy();
                }
            };

            SetBinaryLocationAction.Activated += (sender, e) => {
                Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Set Toon Boom binary location.", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Select Folder.", ResponseType.Accept);
                fc.SetCurrentFolder(@"C://Program Files (x86)/Toon Boom Animation/Toon Boom Harmony 12.2 Advanced/win64/bin");

                if (fc.Run() == (int)ResponseType.Accept)
                {
                    ProjectController.ConfigController.SetToonBoomBinPath(fc.Filename);

                    fc.Destroy();

                    if (ProjectController.ConfigController.Validate())
                    {
                        Gtk.MessageDialog dialog = new Gtk.MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Close, "Executables found.");
                        dialog.Title = "Success";
                        dialog.Run();
                        dialog.Destroy();
                    }
                    else
                    {
                        Gtk.MessageDialog dialog = new Gtk.MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Executables could not be found.");
                        dialog.Title = "Error";
                        dialog.Run();
                        dialog.Destroy();
                    }
                }
                else
                {
                    fc.Destroy();
                }
            };
        }
示例#3
0
 private void OpenFile(Uri uri)
 {
     ProjectController ctrler = ProjectController.LoadProject(uri);
     ProjectWindow     window = new ProjectWindow(ctrler);
 }