Example #1
0
        void editingAction_ChangesMade(SlideAction obj)
        {
            String actionText = textEditor.Text;

            if (actionText == null)
            {
                actionText = "";
            }
            if (actionText.Length > 33)
            {
                actionText = actionText.Substring(0, 30) + "...";
            }

            undoBuffer.pushAndExecute(new TwoWayDelegateCommand <SlideAction, SlideAction>(CopySaver.Default.copy(currentAction), slide.getAction(currentAction.Name),
                                                                                           new TwoWayDelegateCommand <SlideAction, SlideAction> .Funcs()
            {
                ExecuteFunc = (exec) =>
                {
                    notificationManager.showNotification(String.Format("Changed trigger \"{0}\" action.", actionText), PreviewIconName, 3);
                    slide.replaceAction(exec);
                },
                UndoFunc = (undo) =>
                {
                    notificationManager.showNotification(String.Format("Undid trigger \"{0}\" action.", actionText), PreviewIconName, 3);
                    slide.replaceAction(undo);
                },
            }));
        }
Example #2
0
        private void writeImageToDisk(String outputDirectory, String imageBaseName, String extension, FREE_IMAGE_FORMAT imageOutputFormat)
        {
            String fileName = imageBaseName + extension;

            ensureOutputFolderExists(outputDirectory);
            String outputFile = Path.Combine(outputDirectory, fileName);

            if (File.Exists(outputFile))
            {
                String[] sameNameFiles = Directory.GetFiles(outputDirectory, String.Format("{0}*{1}", imageBaseName, extension), SearchOption.TopDirectoryOnly);
                int      fileIndex     = sameNameFiles.Length;
                fileName   = String.Format("{0}{1}{2}", imageBaseName, fileIndex, extension);
                outputFile = Path.Combine(outputDirectory, fileName);
                //Not as likely to hit this part so just loop for the filename, this will only happen if they skipped one name
                while (File.Exists(outputFile))
                {
                    fileName   = String.Format("{0}{1}{2}", imageBaseName, ++fileIndex, extension);
                    outputFile = Path.Combine(outputDirectory, fileName);
                }
            }
            using (Stream stream = File.Open(outputFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
            {
                currentImage.Save(stream, imageOutputFormat);
            }
            notificationManager.showNotification(new OpenImageNotification(outputFile));
            closeCurrentImage();
        }
 private void EditingAction_ChangesMade(SlideAction obj)
 {
     undoBuffer.pushAndExecute(new TwoWayDelegateCommand <SlideAction, SlideAction>(CopySaver.Default.copy(currentAction), slide.getAction(currentAction.Name),
                                                                                    new TwoWayDelegateCommand <SlideAction, SlideAction> .Funcs()
     {
         ExecuteFunc = (exec) =>
         {
             notificationManager.showNotification("Changed slider action.", PreviewIconName, 3);
             slide.replaceAction(exec);
         },
         UndoFunc = (undo) =>
         {
             notificationManager.showNotification("Changed slider action.", PreviewIconName, 3);
             slide.replaceAction(undo);
         },
     }));
 }