public MainWindow() { InitializeComponent(); #region setclass CVisibilityPanels cVisibilityPanels = new CVisibilityPanels(new List <UIElement> { PanelDButtonVolume, Test }, Test); DTimeSliderPanel.GetSlider().ValueChanged += MainWindow_ValueChanged; controlsMouseUpAndDown = new ControlsMouseUpAndDown(DVolumeSliderpanel); #endregion this.Loaded += (o, e) => { if (SystemIO.isValid(fileUpdate.path)) { settring = serializer.Deserialize(SystemIO.Read(fileUpdate.path)); DVolumeSliderpanel.Value = settring.Volume; this.SetSize(settring.WindowSize); } else { DVolumeSliderpanel.Value = settring.Volume; Save(); //------------ } soundEngine.Volume = (float)DVolumeSliderpanel.Value / 100; PanelDButtonVolume.SetIconVolume((float)DVolumeSliderpanel.Value); new WinResize(this).RightDown(Border_ResizeWindow); if (SystemIO.isValid(SOUND_LIST_ALL.path)) { try { cur_list_sound = SOUND_LIST_ALL_serializer.Deserialize(SystemIO.Read(SOUND_LIST_ALL.path)); } catch (Exception) { SOUND_LIST_ALL_serializer.Serialize(cur_list_sound); } UpdateSoundList(); } }; timerTick = new TimerTick(); timerTick.Tick += TimerTick_Tick; timerTick.Start(); }
public WindResize(Window w) { Wind = w; Width = Wind.Width; Height = Wind.Height; timerTick.Tick += (sender, e) => { if (Mouse.LeftButton == MouseButtonState.Released) { isMouseDoun = false; } if (isMouseDoun) { Update(); } Wind.Width = Width < 40?40: Width; Wind.Height = Height < 40 ? 40 : Height; }; timerTick.Start(); Wind.MouseLeftButtonDown += (sender, e) => { if (isMouseMoove && isMouseDoun == false) { Wind.DragMove(); } }; Wind.MouseEnter += (sender, e) => isMouseMoove = true; Wind.MouseLeave += (sender, e) => isMouseMoove = false; }
private void LabelClosing_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { IsSuspend = !IsSuspend; LabelClosing.Content = $"Suspend {IsSuspend}"; if (IsSuspend) { LabelClosing.Foreground = Brushes.Green; timerTick.Start(); } else { LabelClosing.Foreground = Brushes.White; timerTick.Stop(); } }
public void TimerSet(bool b) { switch (b) { case true: timerTick.Start(); timerTick2.Start(); Grid1.Visibility = Visibility.Visible; Grid2.Visibility = Visibility.Hidden; break; case false: timerTick.Stop(); timerTick2.Stop(); Grid1.Visibility = Visibility.Hidden; Grid2.Visibility = Visibility.Visible; break; default: break; } }
public WindEntityInf() { InitializeComponent(); this.Top = 545; this.Left = 1; timerTick.Tick += (o, e) => { List <Process> lis = Proc.find("gmod"); if (lis.Count == 0) { return; } WindowGmod = lis[0].MainWindowHandle; if (string.IsNullOrEmpty(s)) { this.Visibility = Visibility.Hidden; } else { if (Proc.GetMainWindowTitle() == lis[0].MainWindowTitle) { this.Visibility = Visibility.Visible; Win32Api.HideFromAltTabAndTopMost(this); } else { this.Visibility = Visibility.Hidden; } } //using (var gr = Graphics.FromHwnd(IntPtr.Zero)) // gr.DrawRectangle(Pens.Red, new System.Drawing.Rectangle(1920 / 2 - 5, 1080 / 2 - 5, 10, 10)); #region MyRegion //foreach (UIElement item in StackPanel_list.Children) //{ // if(item.GetType().ToString() == "System.Windows.Controls.Label") // { // var label = (Label)item; // label.Content = $"{R.Next(10, 111)}"; // } //} //foreach (var item in Proc.find("gmod")) //{ //} //for (int i = 0; i < lis.Count; i++) //{ // labels[i].Content = $"{lis[i].ProcessName} {lis[i].Id} {lis[i].MainWindowTitle}"; //} //labels[0].Content = Proc.GetMainWindowTitle(); #endregion }; timerTick.Start(); }
public MainWindow() { InitializeComponent(); //System.Windows.MessageBox.Show($"{new WinScreen(this).ScreenSize}"); //cfg_Json cfg_d = new cfg_Json(); //cfg_d.Config = cfg; //cfg_d.Serialize(); //cfg_d.Deserialize(); //System.Windows.MessageBox.Show(cfg_d.ToString()); #region OpenNewSetttingProgram if (j.IsVoidFile()) { j.OpenJson(); if (j.isOpen) { cfg = j.Config; } else { cfg = new Configuration(); } } else { j.Config = cfg; j.SaveJson(); } Setting(); #endregion timer.Time = cfg.TimeInterval; timer.Tick += Timer_Tick; timer.Start(); audio.StartRecording(); audio.CSmoothHistogram = cfg.CountSmoothHistogram; ntic.Icon = Properties.Resources.Icon_ico; ntic.Visible = true; ntic.MouseClick += delegate(object sender, System.Windows.Forms.MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: break; case MouseButtons.None: break; case MouseButtons.Right: windNotify = windNotify ?? new WindNotify(); // Size size_ = new WinScreen(this).ScreenSize; windNotify.SetSize(size_.X * 0.7, size_.Y * 0.7); windNotify.SetCen(size_.X, size_.Y); windNotify.Show(); windNotify.ColorBoxs[0].Text = $"{cfg.ColorLine.A},{cfg.ColorLine.R},{cfg.ColorLine.G},{cfg.ColorLine.B}"; foreach (var item in windNotify.textBoxes) { windNotify.EventTextChanged(item, EventText_notify); } foreach (var item in windNotify.CheckBoxs) { windNotify.EventMouseDownChanged(item, EventClick); } foreach (var item in windNotify.ColorBoxs) { item.TextCh(EventText_notify); } windNotify.Topmost = true; break; case MouseButtons.Middle: break; case MouseButtons.XButton1: break; case MouseButtons.XButton2: break; default: break; } }; }
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); }