Esempio n. 1
0
        void fullSizeButton_MouseButtonClick(Widget source, EventArgs e)
        {
            if (currentImage != null)
            {
                String windowName = imageName.OnlyText;
                if (windowName == null)
                {
                    windowName = "";
                }

                String            extension;
                FREE_IMAGE_FORMAT imageOutputFormat;
                getImageFormat(out extension, out imageOutputFormat);

                //Save the image as a temporary file and open it with the system file viewer
                String imageFile = String.Format("{0}/TempImage{1}", MedicalConfig.UserDocRoot, extension);
                try
                {
                    using (Stream stream = File.Open(imageFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
                    {
                        currentImage.Save(stream, imageOutputFormat);
                    }
                    OtherProcessManager.openLocalURL(imageFile);
                }
                catch (Exception ex)
                {
                    MessageBox.show(String.Format("Error writing the preview file to {0}.\nReason: {2}", imageFile, MedicalConfig.ImageOutputFolder, ex.Message), "Save Error", MessageBoxStyle.IconError | MessageBoxStyle.Ok);
                }
            }
        }
Esempio n. 2
0
        void openOutputFolder_MouseButtonClick(Widget source, EventArgs e)
        {
            String folder = outputFolder.OnlyText;

            try
            {
                ensureOutputFolderExists(folder);
                OtherProcessManager.openLocalURL(outputFolder.OnlyText);
            }
            catch (Exception ex)
            {
                MessageBox.show(String.Format("Could not open output directory {0}.\nReason: {1}", folder, ex.Message), "Error", MessageBoxStyle.Ok | MessageBoxStyle.IconError);
            }
        }
Esempio n. 3
0
 public override void clicked()
 {
     OtherProcessManager.openLocalURL(filename);
 }
Esempio n. 4
0
        void fileBrowser_NodeContextEvent(FileBrowserTree tree, string path, bool isDirectory, bool isTopLevel)
        {
            ContextMenu contextMenu = new ContextMenu();

            if (isDirectory)
            {
                contextMenu.add(new ContextMenuItem("Create Directory", path, delegate(ContextMenuItem item)
                {
                    InputBox.GetInput("Directory Name", "Please enter a name for the directory.", true, delegate(String result, ref String errorPrompt)
                    {
                        editorController.ResourceProvider.createDirectory(item.UserObject.ToString(), result);
                        return(true);
                    });
                }));

                contextMenu.add(new ContextMenuItem("Add Item", path, delegate(ContextMenuItem item)
                {
                    AddItemDialog.AddItem(editorController.ItemTemplates, (itemTemplate) =>
                    {
                        try
                        {
                            ((ProjectItemTemplate)itemTemplate).createItem(path, editorController);
                        }
                        catch (Exception e)
                        {
                            MessageBox.show(String.Format("Error creating item.\n{0}", e.Message), "Error Creating Item", MessageBoxStyle.IconError | MessageBoxStyle.Ok);
                        }
                    });
                }));

                contextMenu.add(new ContextMenuItem("Import Files", path, delegate(ContextMenuItem item)
                {
                    FileOpenDialog fileDialog = new FileOpenDialog(MainWindow.Instance, "Choose files to import.", "", "", "", true);
                    fileDialog.showModal((result, paths) =>
                    {
                        if (result == NativeDialogResult.OK)
                        {
                            editorController.importFiles(paths, item.UserObject.ToString());
                        }
                    });
                }));

                contextMenu.add(new ContextMenuItem("Explore To", path, item =>
                {
                    OtherProcessManager.openLocalURL(editorController.ResourceProvider.getFullFilePath(item.UserObject.ToString()));
                }));
            }
            if (!isTopLevel)
            {
                contextMenu.add(new ContextMenuItem("Rename", path, delegate(ContextMenuItem item)
                {
                    InputBox.GetInput("Rename", String.Format("Please enter a new name for {0}.", item.UserObject.ToString()), true, delegate(String result, ref String errorPrompt)
                    {
                        String originalExtension = Path.GetExtension(item.UserObject.ToString());
                        String targetName        = Path.ChangeExtension(Path.Combine(Path.GetDirectoryName(item.UserObject.ToString()), result), originalExtension);
                        if (editorController.ResourceProvider.exists(targetName))
                        {
                            errorPrompt = String.Format("A file named {0} already exists. Please enter another name.", targetName);
                            return(false);
                        }

                        editorController.ResourceProvider.move(path, targetName);
                        return(true);
                    });
                }));
                contextMenu.add(new ContextMenuItem("Delete", path, delegate(ContextMenuItem item)
                {
                    MessageBox.show(String.Format("Are you sure you want to delete {0}?", item.UserObject.ToString()), "Delete?", MessageBoxStyle.IconQuest | MessageBoxStyle.Yes | MessageBoxStyle.No, delegate(MessageBoxStyle result)
                    {
                        if (result == MessageBoxStyle.Yes)
                        {
                            editorController.ResourceProvider.delete(item.UserObject.ToString());
                        }
                    });
                }));
            }
            tree.showContextMenu(contextMenu);
        }