Exemple #1
0
        private async void RandomLe(int max)
        {
            DisableElements();
            await Task.Run(() => { ImgMdf.RandomLe(max, AppVars.Progress); }).ConfigureAwait(true);

            DrawCanvas();
            EnableElements();
        }
Exemple #2
0
        private async void Import(int max)
        {
            DisableElements();
            await Task.Run(() => { ImgMdf.Import(max, AppVars.Progress); }).ConfigureAwait(true);

            await Task.Run(() => { ImgMdf.Find(AppVars.Progress); }).ConfigureAwait(true);

            DrawCanvas();
            EnableElements();
        }
Exemple #3
0
        private void DoCompute(object s, DoWorkEventArgs args)
        {
            while (!_backgroundWorker.CancellationPending)
            {
                ImgMdf.Compute(_backgroundWorker);
                Thread.Sleep(100);
            }

            args.Cancel = true;
        }
Exemple #4
0
        private async void Rotate(RotateFlipType rft)
        {
            DisableElements();
            await Task.Run(() => { ImgMdf.Rotate(AppVars.ImgPanel[0].Img.Id, rft); }).ConfigureAwait(true);

            await Task.Run(() => { ImgMdf.Find(AppVars.Progress); }).ConfigureAwait(true);

            DrawCanvas();
            EnableElements();
        }
Exemple #5
0
        private async void ButtonLeftNextMouseClick()
        {
            DisableElements();
            await Task.Run(() => { ImgMdf.Confirm(); }).ConfigureAwait(true);

            await Task.Run(() => { ImgMdf.Find(AppVars.Progress); }).ConfigureAwait(true);

            DrawCanvas();
            EnableElements();
        }
Exemple #6
0
        private async void WindowLoaded()
        {
            BoxLeft.MouseDown  += PictureLeftBoxMouseClick;
            BoxRight.MouseDown += PictureRightBoxMouseClick;

            LabelLeft.MouseDown  += ButtonLeftNextMouseClick;
            LabelRight.MouseDown += ButtonRightNextMouseClick;

            Left   = SystemParameters.WorkArea.Left + AppConsts.WindowMargin;
            Top    = SystemParameters.WorkArea.Top + AppConsts.WindowMargin;
            Width  = SystemParameters.WorkArea.Width - AppConsts.WindowMargin * 2;
            Height = SystemParameters.WorkArea.Height - AppConsts.WindowMargin * 2;
            Left   = SystemParameters.WorkArea.Left + (SystemParameters.WorkArea.Width - AppConsts.WindowMargin - Width) / 2;
            Top    = SystemParameters.WorkArea.Top + (SystemParameters.WorkArea.Height - AppConsts.WindowMargin - Height) / 2;

            _picsMaxWidth   = Grid.ActualWidth;
            _labelMaxHeight = LabelLeft.ActualHeight;
            _picsMaxHeight  = Grid.ActualHeight - _labelMaxHeight;

            _notifyIcon.Icon         = new Icon(@"app.ico");
            _notifyIcon.Visible      = false;
            _notifyIcon.DoubleClick +=
                delegate
            {
                Show();
                WindowState         = WindowState.Normal;
                _notifyIcon.Visible = false;
                RedrawCanvas();
            };

            AppVars.Progress = new Progress <string>(message => Status.Text = message);

            DisableElements();
            await Task.Run(() => { ImgMdf.LoadImages(AppVars.Progress); }).ConfigureAwait(true);

            await Task.Run(() => { ImgMdf.Find(AppVars.Progress); }).ConfigureAwait(true);

            DrawCanvas();

            EnableElements();

            AppVars.SuspendEvent = new ManualResetEvent(true);

            _backgroundWorker = new BackgroundWorker {
                WorkerSupportsCancellation = true, WorkerReportsProgress = true
            };
            _backgroundWorker.DoWork          += DoCompute;
            _backgroundWorker.ProgressChanged += DoComputeProgress;
            _backgroundWorker.RunWorkerAsync();
        }
Exemple #7
0
        private async void ImgPanelDelete(int index)
        {
            DisableElements();
            await Task.Run(() => { ImgMdf.Delete(AppVars.ImgPanel[index].Img.Id); }).ConfigureAwait(true);

            if (index == 1)
            {
                await Task.Run(() => { ImgMdf.UpdateLastViewOnly(); }).ConfigureAwait(true);
            }

            await Task.Run(() => { ImgMdf.Find(AppVars.Progress); }).ConfigureAwait(true);

            DrawCanvas();
            EnableElements();
        }