Пример #1
0
        public void Setting()
        {
            SetSize(cfg.SizeWindow);
            SetPos(cfg.PositionWindow);
            #region textBoxes CheckBoxs
            windNotify.textBoxes[0].Text = cfg.SizeWindow.ToString();
            windNotify.textBoxes[1].Text = cfg.CountSmoothHistogram.ToString();
            windNotify.textBoxes[2].Text = cfg.SizeLineHeight.ToString();
            windNotify.textBoxes[3].Text = cfg.PositionWindow.ToString();
            windNotify.textBoxes[4].Text = cfg.SmoothnessLine.ToString();

            windNotify.CheckBoxs[0].Active = cfg.TomMost;
            windNotify.CheckBoxs[1].Active = cfg.isSmoothness;
            #endregion

            //
            Dispatcher.BeginInvoke(
                new ThreadStart(delegate {
                ControlsLib.CreateLine(this.Height, this.Width, cfg.SizeLineHeight, ListLine, cfg.ColorLine);
            }));
            timer.Time = cfg.TimeInterval;

            audio.Dada = cfg.Dada;
            audio.Db   = cfg.Db;
        }
Пример #2
0
        //private void ListLabel_Loaded(object sender, RoutedEventArgs e)
        //    => Dispatcher.BeginInvoke(
        //        new ThreadStart(delegate {
        //            ControlsLib.CreateLine(this.Height, this.Width, cfg.SizeLineHeight, ListLine, cfg.ColorLine);
        //        }));

        private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            //ControlsLib.Clear();
            Dispatcher.BeginInvoke(
                new ThreadStart(delegate {
                ControlsLib.CreateLine(this.Height, this.Width, cfg.SizeLineHeight, ListLine, cfg.ColorLine);
            }));
        }
Пример #3
0
        void EventText_notify(object sender, TextChangedEventArgs e)
        {
            #region Size window
            string   text_size = windNotify.textBoxes[0].Text;
            string[] strarray  = text_size.Split(new char[] { '*' });
            if (strarray.Length != 2)
            {
                return;
            }
            if (int.TryParse(strarray[0], out int x) && int.TryParse(strarray[1], out int y))
            {
                SetSize(cfg.SizeWindow = new Size(x, y));
                SetPos(cfg.PositionWindow);
            }
            #endregion
            #region Smooth
            string text_Smooth = windNotify.textBoxes[1].Text;
            if (int.TryParse(text_Smooth, out int c))
            {
                audio.CSmoothHistogram = cfg.CountSmoothHistogram = c;
            }
            #endregion
            #region sizeline
            string text_sizeline = windNotify.textBoxes[2].Text;
            if (int.TryParse(text_sizeline, out int s))
            {
                cfg.SizeLineHeight = s > 3? s:3;
                ControlsLib.Clear();
                ControlsLib.CreateLine(this.Height, this.Width, cfg.SizeLineHeight, ListLine, cfg.ColorLine);
            }
            #endregion
            #region Position window
            string[] strarray_positionwind = windNotify.textBoxes[3].Text.Split(new char[] { '*' });
            if (strarray_positionwind.Length != 2)
            {
                return;
            }
            if (int.TryParse(strarray_positionwind[0], out int x_p) && int.TryParse(strarray_positionwind[1], out int y_p))
            {
                SetPos(cfg.PositionWindow = new Point(
                           x_p,
                           y_p
                           ));
            }
            #endregion
            #region SmoothnessLine
            if (double.TryParse(windNotify.textBoxes[4].Text, out double s_))
            {
                cfg.SmoothnessLine = s_;
            }
            #endregion

            cfg.ColorLine = windNotify.ColorBoxs[0].ColorARGB;
            SaveSetting();
            Setting();
        }
Пример #4
0
        void Timer_Tick(object sender, EventArgs e)
        {
            this.Topmost = cfg.TomMost;
            switch (AudioDevice.IsWorking())
            {
            case true:
                if (j.isUpdateFile())
                {
                    if (windNotify.IsActive)
                    {
                        return;
                    }
                    //Debug.WriteLine("Обновление настроек...");
                    Thread.Sleep(100);
                    j.OpenJson();
                    cfg = j.Config;
                    Setting();
                }
                if (audio.GetStatus == false)
                {
                    ControlsLib.IsMinAll = true;
                }

                audio.StartRecording();
                double inc = ControlsLib.MinAllDouble();

                for (int i = 0; i < ControlsLib.Count(); i++)
                {
                    double size_h      = audio.list_array[i];
                    double last_size_h = ControlsLib.GetElementByID(i).SizeHeight;
                    double len_double  = last_size_h;

                    size_h = size_h > 5 ? this.Height - size_h  : 5;


                    if (size_h > last_size_h)
                    {
                        switch (cfg.isSmoothness)
                        {
                        case true:
                            len_double += size_h * cfg.SmoothnessLine;
                            break;

                        case false:
                            len_double = size_h;
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        len_double -= cfg.Increment;
                    }
                    ControlsLib.GetElementByID(i).SizeHeight = len_double - inc * 0.98;
                }

                ControlsLib.SmoothHistogram(ControlsLib.Lines);

                break;

            case false:
                #region Не трогай блять Оно и так зАибись робит!
                int Csi = ControlsLib.Count() * 5;
                int si  = 0;
                if (ControlsLib.IsMinAll)
                {
                    for (int i = 0; i < ControlsLib.Count(); i++)
                    {
                        double d = ControlsLib.GetElementByID(i).SizeHeight -= cfg.Increment;

                        si += d < 5? 5 : (int)d;
                    }
                    if (Csi == si)
                    {
                        ControlsLib.IsMinAll = false;
                    }
                }
                else
                {
                    audio.StopRecording();
                }
                #endregion
                break;

            default:
                break;
            }
        }