Exemple #1
0
 public UcMessageBox()
 {
     InitializeComponent();
     WinResize winResize = new WinResize(this);
 }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            string str = StaticDir.full(StaticData.FolderSetting, "fft_setting.uc");

            fileUpdate = new FileUpdate(str);


            if (SystemIO.isValid(fileUpdate.path))
            {
                Open();
                ReloadLines();
                SetNewOptions();
            }
            else
            {
                setting.PositionWindow = new UcLib.Point(new ScreenSize().Width / 2 - this.Width / 2, new ScreenSize().Height / 2 - this.Height / 2);
                setting.SizeWindow     = this.GetSize();
                Save();
            }
            this.SizeChanged += (o, ev) => ReloadLines();
            this.Closed      += (o, ev) =>
            {
                Save();
                audio.Stop();
            };


            timerTick.Tick += (o, ev) =>
            {
                string debug_data    = "\n";
                int    count_3_debug = 0;
                if (fileUpdate.isUpdate())
                {
                    Open();
                    SetNewOptions();
                }



                if (audio.list_array.Count != 0)
                {
                    for (int i = 0; i < count_; i++)
                    {
                        double si_ = 0;
                        if (audio.isValidVolume)
                        {
                            si_ = audio.list_array[i];
                            switch (setting.isSmoothness)
                            {
                            case true:
                                if (fft_count_int.Count < count_)
                                {
                                    ListPanel.SetSizeAdd(i, si_);
                                    fft_count_int.Add(si_);
                                }

                                else
                                {
                                    if (si_ > fft_count_int[i])
                                    {
                                        ListPanel.SetSizeH(i, si_);
                                    }
                                    else
                                    {
                                        ListPanel.SetSizeAdd(i, setting.Smoothness);
                                        fft_count_int[i] = si_;
                                    }
                                }

                                break;

                            case false:
                                ListPanel.SetSizeH(i, si_);
                                break;

                            default:
                                break;
                            }
                            if (setting.Size_n <= 0)
                            {
                                debug_data += $"{(int)si_} ";
                            }
                            else
                            {
                                count_3_debug++;
                                if (count_3_debug <= setting.Size_n)
                                {
                                    debug_data += $"{(int)si_} ";
                                }
                                else
                                {
                                    debug_data   += "\n";
                                    count_3_debug = 0;
                                }
                            }
                        }
                        else
                        {
                            ListPanel.SetSizeAdd(i, -setting.Smoothness);
                        }
                    }
                }

                if (setting.isDebug)
                {
                    Cont.SetText(
                        $"Count lines: {count_}\n" +
                        $"Audio[Length]: {audio.Length}\n" +
                        $"Audio[list_array]: {audio.list_array.Count}\n" +
                        $"Audio[double]: {debug_data}"

                        );
                }
            };

            audio.Start();
            SetNewOptions();
            timerTick.Start();
            // Кдасс для изменения размера окна. (Не трогать!)
            WinResize winResize = new WinResize(this);

            winResize.RightDown(ResizeBorder);
        }