Example #1
0
 private void AnimateText(string text)
 {
     MyAnimations.AnimateRenderTranslation(TextLine, TranslateTransform.XProperty,
                                           0, (_increased ? -1 : 1) * TextLine.ActualWidth, 200, 0,
                                           (s, args) =>
     {
         TextLine.Text = text;
         DoFlyin();
     });
 }
Example #2
0
 private void DoFlyin()
 {
     MyAnimations.AnimateRenderTranslation(TextLine, TranslateTransform.XProperty,
                                           (_increased ? 1 : -1) * TextLine.ActualWidth, 0, 200);
 }
Example #3
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);
                }
            }
        }
Example #4
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);
        }