Ejemplo n.º 1
0
        private void ButtonClick(object sender, EventArgs e)
        {
            try
            {
                Button b = (Button)sender;
                switch (b.Name)
                {
                case "buttonPrevious":
                    PreviousFrame();
                    break;

                case "buttonNext":
                    NextFrame();
                    break;

                default:
                    CleverMessageBox.Show(b.Name, this);
                    break;
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
Ejemplo n.º 2
0
        private void ToolStripMenuItemClick(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem item = (ToolStripMenuItem)sender;
                switch (item.Name)
                {
                case "loadGIFFileToolStripMenuItem":
                    DoLoadGif();
                    break;

                case "extractFramesToBitmapsToolStripMenuItem":
                    DoExtractFrames();
                    break;

                case "createDebugXMLToolStripMenuItem":
                    // Do nothing - we check the state of this menu item
                    // as part of the decode process.
                    break;

                case "aboutToolStripMenuItem":
                    AboutForm.Show();
                    break;

                default:
                    CleverMessageBox.Show(item.Name, this);
                    break;
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Allows the user to add a colour to the palette, using a
        /// <see cref="System.Windows.Forms.ColorDialog"/>.
        /// </summary>
        private void AddColour()
        {
            if (_palette.Count >= 256)
            {
                CleverMessageBox.Show("Colour table is full",
                                      "Error",
                                      MessageBoxButtons.OK,
                                      MessageBoxIcon.Exclamation,
                                      this);
                return;
            }

            ColorDialog CD = new ColorDialog();

            CD.FullOpen = true;
            DialogResult result = CD.ShowDialog();

            if (result.Equals(DialogResult.OK))
            {
                Color n = CD.Color;
                _palette.Add(n);
                _isDirty = true;
                UpdateUI();
            }
        }
Ejemplo n.º 4
0
 private void FormClosingHandler(object sender, FormClosingEventArgs e)
 {
     if (_allowToClose == false)
     {
         string message = "The process is still running - "
                          + "are you sure you want to close this window?";
         string       caption = "Close window?";
         DialogResult result  =
             CleverMessageBox.Show(message,
                                   caption,
                                   MessageBoxButtons.YesNo,
                                   MessageBoxIcon.Warning,
                                   this);
         if (result == DialogResult.No)
         {
             // don't close the window
             e.Cancel = true;
         }
         else
         {
             // Close the window and abort any processes associated with
             // it.
             _isClosing = true;
             StopTheClock();
             _backgroundThread.Abort();
         }
     }
 }
Ejemplo n.º 5
0
        private DialogResult CheckSaveChangedPalette()
        {
            if (_isDirty)
            {
                // TESTME: CheckSaveChangedPalette method - _isDirty = true
                string message = "Palette was changed, do you want to save it first ?";
                string caption = "Save first ?";

                DialogResult result
                    = CleverMessageBox.Show(message,
                                            caption,
                                            MessageBoxButtons.YesNoCancel,
                                            MessageBoxIcon.Question,
                                            this);
                return(result);
            }
            return(DialogResult.OK);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Call this method from the event handler. Starts the ExtractFrames
        /// method off on a background thread.
        /// </summary>
        void DoExtractFrames()
        {
            if (_decoder == null)
            {
                CleverMessageBox.Show("You haven't loaded a GIF file yet!",
                                      this);
                return;
            }

            folderBrowserDialog1.SelectedPath
                = Path.GetDirectoryName(openFileDialog1.FileName);
            DialogResult result = folderBrowserDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                _extractPath = folderBrowserDialog1.SelectedPath;
                ExtractFrames();
            }
        }
Ejemplo n.º 7
0
        private void DoEncode()
        {
            if (_encoder.Frames.Count < 1)
            {
                CleverMessageBox.Show("This animation has no frames!",
                                      "Error",
                                      MessageBoxButtons.OK,
                                      MessageBoxIcon.Warning,
                                      this);
                return;
            }

            DialogResult result = saveFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                _saveFileName = saveFileDialog1.FileName;
                StartBackgroundProcess(_encoder, Encode, "Encoding...");
            }
        }
Ejemplo n.º 8
0
        void ToolStripMenuItemClick(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem tsmi = (ToolStripMenuItem)sender;
                switch (tsmi.Name)
                {
                case "encodeGIFFileToolStripMenuItem":
                    DoEncode();
                    break;

                case "addFrameBeforeCurrentToolStripMenuItem":
                    AddFrames(true);
                    break;

                case "addFrameAfterCurrentToolStripMenuItem":
                    AddFrames(false);
                    break;

                case "removeCurrentFrameToolStripMenuItem":
                    RemoveFrame();
                    break;

                case "reorderFramesToolStripMenuItem":
                    ReorderFrames();
                    break;

                case "aboutToolStripMenuItem":
                    AboutForm.Show();
                    break;

                default:
                    CleverMessageBox.Show(tsmi.Name, this);
                    break;
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Saves the current palette to an Adobe Colour Table file using the
        /// filename it was loaded from.
        /// If it doesn't have a filename yet, the user is prompted to set one
        /// using a SaveFileDialog.
        /// </summary>
        private void Save()
        {
            if (string.IsNullOrEmpty(_fileName))
            {
                SavePaletteAs();
                return;
            }
            else
            {
                _palette.WriteToFile(_fileName);
            }

            string basename = System.IO.Path.GetFileName(_fileName);
            string message  = "File " + basename + " saved";

            CleverMessageBox.Show(message,
                                  "Saved",
                                  MessageBoxButtons.OK,
                                  MessageBoxIcon.Exclamation,
                                  this);
            _isDirty = false;
        }