Пример #1
0
        private void CloseAnimation()
        {
            Topmost = true;

            MyAnimations.AnimateOpacity(SurfGrid, Opacity, 0, 150);
            MyAnimations.AnimateRenderScale(this, 1, 0.0001, ActualWidth / 2, ActualHeight / 2, 300,
                                            (sender, args) => Close(), ScaleTransform.ScaleYProperty);
        }
Пример #2
0
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            base.OnMouseUp(e);

            MyAnimations.AnimateRenderScale(this, 0.98, 1, ActualWidth / 2, ActualHeight / 2, 100);

            if (OnClick != null)
            {
                OnClick(this);
            }
        }
Пример #3
0
        public void OnRight(object sender, MouseButtonEventArgs e)
        {
            if (_items != null)
            {
                if (SelectedItem < _items.Count - 1)
                {
                    SelectedItem++;
                }
                else
                {
                    SelectedItem = 0;
                }

                var polygon = (Polygon)sender;
                MyAnimations.AnimateRenderScale(polygon, 1, 0.9,
                                                polygon.ActualWidth / 2, polygon.ActualHeight / 2, 200, null, null, true);
            }
        }
Пример #4
0
        private void WriteOutputMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (Grid3.Opacity < 1.0)
            {
                return;
            }

            var grid = (Grid)sender;

            MyAnimations.AnimateRenderScale(grid, 1.0, 0.98,
                                            grid.ActualWidth / 2, grid.ActualHeight / 2, 100, (s, t) => Dispatcher.InvokeAsync(() =>
            {
                if (ImageProcessingInfo.Opacity < 1.0)
                {
                    var fileName = "";
                    if (SaveFileDialog(ref fileName) == false)
                    {
                        return;
                    }

                    _targetFile = fileName;

                    Grid1.IsEnabled = false;
                    Grid2.IsEnabled = false;

                    MyAnimations.AnimateOpacity(LabelWriteOutput, 1.0, 0, 300);
                    MyAnimations.AnimateOpacity(ImageProcessingInfo, 0, 1.0, 300);

                    if (Image3.Opacity > 0)
                    {
                        MyAnimations.AnimateOpacity(Image3, 1.0, 0, 300);
                    }

                    LabelProcessingPersent.Content = "Processing: 0%";

                    StartProcessing();
                }
                else
                {
                    CloseRunningProcess();
                }
            }), null, true);
        }
Пример #5
0
        protected override void OnMouseDown(MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);

            MyAnimations.AnimateRenderScale(this, 1, 0.98, ActualWidth / 2, ActualHeight / 2, 100);
        }
Пример #6
0
 private void Maximize()
 {
     MyAnimations.AnimateOpacity(this, 0.1, 1, 300);
     MyAnimations.AnimateRenderScale(this, 0.1, 1, ActualWidth / 2, ActualHeight / 2, 300);
 }
Пример #7
0
        private void AddProcessingMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (Grid2.Opacity < 1.0)
            {
                return;
            }
            if (Grid2.IsEnabled == false)
            {
                return;
            }

            var grid = (Grid)sender;

            if (Image2.Opacity < 1.0 && Grid2.Opacity > 0)
            {
                Image2.IsEnabled = true;

                MyAnimations.AnimateRenderScale(grid, 1.0, 0.98,
                                                grid.ActualWidth / 2, grid.ActualHeight / 2, 100, null, null, true);

                MyAnimations.AnimateRenderTranslation(Grid3, TranslateTransform.YProperty,
                                                      -Grid1.ActualHeight - 20, 0, 300, 50);
                MyAnimations.AnimateOpacity(Grid3, 0, 0.7, 100, 50);

                MyAnimations.AnimateOpacity(LabelAddProcessing, 1.0, 0.0, 300);
                MyAnimations.AnimateOpacity(Image2, 0.0, 1.0, 300);
            }
            else
            {
                if (Image2.IsEnabled && (FiltersGraph.GetFiltersCount() < 4 ||
                                         FiltersGraph.SelectedFilter != -1))
                {
                    Image2.IsEnabled = false;

                    var edit = new FilterEdit
                    {
                        ApplyClick  = FilterApplyClick,
                        DeleteClick = FilterDeleteClick
                    };

                    if (FiltersGraph.SelectedFilter != -1)
                    {
                        var filter = FiltersGraph.GetFilterDef(FiltersGraph.SelectedFilter);
                        edit.TypeOfFilter = filter.Item1;
                        edit.FrequencyOne = filter.Item2;
                        edit.FrequencyTwo = filter.Item3;
                        edit.EditMode     = true;
                    }
                    else
                    {
                        edit.TypeOfFilter = _lastFilterType;
                        edit.FrequencyOne = FiltersGraph.MouseFrequency;
                        edit.FrequencyTwo = edit.FrequencyOne + 50;
                        edit.EditMode     = false;
                    }

                    edit.Closed += (o, args) => Image2.IsEnabled = true;
                    MyUtils.ShowCommonDialog(edit, edit.BackGrid, ActualWidth, ActualHeight);
                }
            }
        }
Пример #8
0
        private void SelectSourceMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (Grid1.IsEnabled == false)
            {
                return;
            }

            var grid = (Grid)sender;

            MyAnimations.AnimateRenderScale(grid, 1.0, 0.98,
                                            grid.ActualWidth / 2, grid.ActualHeight / 2, 100, (o, args) =>
            {
                var fileName = "";
                if (OpenFileDialog(ref fileName) == false)
                {
                    return;
                }

                _sourceFile = fileName;

                var runtimeWrap = new RuntimeWrap();

                try
                {
                    var fileInfo = new Dictionary <string, string>();
                    var response = runtimeWrap.GetFileResponse(fileName, ref fileInfo);

                    var fileFreq    = long.Parse(fileInfo["samplerate"]);
                    var fileSamples = long.Parse(fileInfo["samples_per_channel"]);
                    var duration    = fileSamples * 8 / fileFreq;

                    DurationLabel.Content = "File duration: " + TimeSpan.FromSeconds(duration).ToString();

                    var responseConvert =
                        response.Select(
                            tuple => new PointF((float)tuple.Item1, (float)Math.Log(tuple.Item2)))
                        .ToArray();

                    SourceGraph.SetPoints(0, responseConvert, Colors.LightSteelBlue, "Source");

                    if (Grid2.Opacity < 1.0)
                    {
                        Dispatcher.InvokeAsync(() =>
                        {
                            MyAnimations.AnimateRenderTranslation(Grid2, TranslateTransform.YProperty,
                                                                  -Grid1.ActualHeight - 20, 0, 300, 50);
                            MyAnimations.AnimateOpacity(Grid2, 0, 0.7, 100, 50);
                            MyAnimations.AnimateOpacity(LabelSelectDsdiff, 1.0, 0.0, 300);
                            MyAnimations.AnimateOpacity(Image1, 0.0, 1.0, 300);

                            if (LabelLoadError.Opacity > 0)
                            {
                                MyAnimations.AnimateOpacity(LabelLoadError, 1.0, 0, 300);
                            }
                        });
                    }

                    if (LabelWriteOutput.Opacity < 1.0)
                    {
                        Dispatcher.InvokeAsync(() =>
                        {
                            MyAnimations.AnimateOpacity(LabelWriteOutput, 0, 1.0, 300);
                            MyAnimations.AnimateOpacity(ImageProcessingInfo, 1.0, 0, 300);
                        });
                    }

                    if (FiltersGraph.GetFiltersCount() > 0)
                    {
                        Dispatcher.InvokeAsync(() =>
                        {
                            if (Image3.Opacity > 0)
                            {
                                MyAnimations.AnimateOpacity(Image3, 1.0, 0, 300);
                            }

                            if (Grid3.Opacity < 1.0)
                            {
                                MyAnimations.AnimateOpacity(Grid3, 0, 1.0, 300);
                            }
                        });
                    }
                }
                catch (Exception ex)
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        LabelLoadError.Content = "Unable to open file: " + ex.Message;

                        MyAnimations.AnimateOpacity(LabelLoadError, 0, 1.0, 300);

                        if (LabelSelectDsdiff.Opacity < 1.0)
                        {
                            MyAnimations.AnimateOpacity(LabelSelectDsdiff, 0, 1.0, 300);
                        }

                        if (Grid2.Opacity > 0)
                        {
                            MyAnimations.AnimateOpacity(Grid2, 1.0, 0, 300);
                        }

                        if (Grid3.Opacity > 0)
                        {
                            MyAnimations.AnimateOpacity(Grid3, 1.0, 0, 300);
                        }

                        if (Image1.Opacity > 0)
                        {
                            MyAnimations.AnimateOpacity(Image1, 1.0, 0, 300);
                        }
                    });
                }
            }, null, true);
        }