Ejemplo n.º 1
0
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (ClientTextBox.Text == "")
     {
         return;
     }
     _canPreview             = false;
     metroProgressBar1.Value = 0;
     ProgressPanel.BringToFront();
     ProgressPanel.Visible    = true;
     menuStrip1.Enabled       = false;
     metroTabControl1.Enabled = false;
     _selectedTab             = metroTabControl1.SelectedIndex;
     FileWorker.RunWorkerAsync();
 }
Ejemplo n.º 2
0
        private void SaveData()
        {
            for (int i = 0; i <= 500; i++)
            {
                ProgressPanel progressPanel1 = new ProgressPanel();
                progressPanel1.Caption           = "Loading";
                progressPanel1.Description       = "Please wait...";
                progressPanel1.WaitAnimationType = DevExpress.Utils.Animation.WaitingAnimatorType.Ring;
                progressPanel1.Parent            = this;
                progressPanel1.Top  = 100;
                progressPanel1.Left = 100;
                this.Controls.Add(progressPanel1);
                progressPanel1.Show();
                progressPanel1.BringToFront();
                progressPanel1.WaitAnimationType = DevExpress.Utils.Animation.WaitingAnimatorType.Bar;

                Thread.Sleep(10);
            }
        }
Ejemplo n.º 3
0
        private void InputImage_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                ProgressPanel.Visible = true;
                ProgressPanel.BringToFront();
                Enabled = false;
                try
                {
                    _srcPath = openFileDialog1.FileName;
                    FiltersList.SelectedIndex     = 0;
                    _currentlySelectedTmpFilePath = string.Empty;
                    _currentlySelectedFilterEnum  = null;
                    _tmpImgFilePathPattern        = Path.GetTempPath() + "\\" + Guid.NewGuid().ToString();

                    try
                    {
                        InputImage.Image = null;
                        InputImage.Load(_srcPath);

                        ImageInfo imageInfo = new ImageInfo(_srcPath);
                        imageInfo.Start();
                        while (imageInfo.Running)
                        {
                            Application.DoEvents();
                            Thread.Sleep(50);
                        }
                        FileInfoEdit.Text = imageInfo.FileInfoText;
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception);
                        throw;
                    }
                }
                finally
                {
                    ProgressPanel.Visible = false;
                    Enabled = true;
                }
            }
        }
Ejemplo n.º 4
0
        private void FiltersList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedIndex = FiltersList.SelectedIndex;

            if (selectedIndex == 0)
            {
                if (File.Exists(_srcPath))
                {
                    InputImage.Load(_srcPath);
                    _currentlySelectedTmpFilePath = _srcPath;
                    _currentlySelectedFilterEnum  = null;
                }
            }
            else
            {
                selectedIndex = selectedIndex - 1;
                FilterEnum filterEnum         = (FilterEnum)selectedIndex;
                string     tmpFilteredImgPath = _tmpImgFilePathPattern + "_" + filterEnum.ToString() + Path.GetExtension(_srcPath);

                if (File.Exists(tmpFilteredImgPath))
                {
                    InputImage.Load(tmpFilteredImgPath);
                    _currentlySelectedFilterEnum  = filterEnum;
                    _currentlySelectedTmpFilePath = tmpFilteredImgPath;
                }
                else
                {
                    if (File.Exists(_srcPath))
                    {
                        ProgressPanel.Location = new Point(Width / 2 - (ProgressPanel.Width / 2), (Height / 2) - (ProgressPanel.Height / 2));

                        ProgressPanel.Visible = true;
                        ProgressPanel.BringToFront();
                        Enabled = false;
                        try
                        {
                            string result;

                            switch (filterEnum)
                            {
                            case FilterEnum.Nashville:
                                result = ApplyNashville(_srcPath, tmpFilteredImgPath);
                                break;

                            case FilterEnum.Clarendon:
                                result = ApplyClarendon(_srcPath, tmpFilteredImgPath);
                                break;

                            case FilterEnum.Moon:
                                result = ApplyMoon(_srcPath, tmpFilteredImgPath);
                                break;

                            case FilterEnum.Toaster:
                                result = ApplyToaster(_srcPath, tmpFilteredImgPath);
                                break;

                            case FilterEnum.XPro2:
                                result = ApplyXPro2(_srcPath, tmpFilteredImgPath);
                                break;

                            default:
                                throw new ArgumentOutOfRangeException();
                            }

                            if (string.IsNullOrEmpty(result))
                            {
                                if (File.Exists(tmpFilteredImgPath))
                                {
                                    _tmpFilesToClear.Add(tmpFilteredImgPath);
                                    InputImage.Load(tmpFilteredImgPath);
                                    _currentlySelectedTmpFilePath = tmpFilteredImgPath;
                                    _currentlySelectedFilterEnum  = filterEnum;
                                }
                            }
                            else
                            {
                                MessageBox.Show(result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        finally
                        {
                            ProgressPanel.Visible = false;
                            Enabled = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Can't find input file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }