public ArduinoEMGPlotter(ref Chart chart, ref Label _lblBufferStatus, ref Bunifu.Framework.UI.BunifuProgressBar _calib_progress_bar) { iniciarVariaveisProcessamento(); _k = 2; is_in_calibration = false; calib_progress_bar = _calib_progress_bar; chartHandler = new EMGChart(ref chart, qnt_pontos); //chart com 5000 pontos emgChart = (EMGChart)chartHandler; BufferCalibracao = new CircularBuffer <double>(4096); valorhbt = new double[2048]; chartHandler.ConfigureChart("Leituras", "EMG Plotter"); bufferLabelUpdater = new Timer(); lblBufferStatus = _lblBufferStatus; bufferLabelUpdater.Interval = 50; bufferLabelUpdater.Tick += bufferLabelUpdater_Tick; arduinoHandler = new ArduinoHandler(); dataconsumer = new ThreadHandler(processingRoutine); #region Lambda from hell //() => //{ // if (arduinoHandler.dataWaiting) // { // double valor2add = arduinoHandler.bufferAquisition. // SecureDequeue() * 5 / 1024.0 - 2.5; // chartHandler.AddYToBuffer(valor2add); // #region Janelamento da calibração // if (is_in_calibration) // { // BufferCalibracao.Enqueue(valor2add); // if (BufferCalibracao.Count % 50 == 0) // { // calib_progress_bar.BeginInvoke(new Action(() => // { // calib_progress_bar.Value = (int)(100.0f * BufferCalibracao.Count / (double)BufferCalibracao.Capacity); // })); // } // if (BufferCalibracao.Full) // { // calibrar = BufferCalibracao.ToArray(); // Accord.Math.HilbertTransform.FHT(calibrar, Accord.Math.FourierTransform.Direction.Forward); //aplicar a transformada de Hilbert // calibrar = calibrar.Abs(); // calibrar_filtrado = Butter.Butterworth(calibrar, emgChart.period_aquire, 7); // media = calibrar.Average(); // std = Accord.Statistics.Measures.StandardDeviation(calibrar); // emgChart.limiar = media + k * std; // is_in_calibration = false; // } // } // #endregion // //Esta rotina deve ser Otimizada para que os dados nao sejam processados num Timer // //Os dados devem ir para um buffer de processamento e não para o mesmo buffer de plotagem // } //}); #endregion }
private void InitializeComponent() { m_mediaManager = new MediaManager(); this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(formMainFrame)); this.panelControl = new System.Windows.Forms.Panel(); this.sliderVolume = new Bunifu.Framework.UI.BunifuSlider(); this.buttonShuffle = new Bunifu.Framework.UI.BunifuImageButton(); this.buttonRepeat = new Bunifu.Framework.UI.BunifuImageButton(); this.buttonVolumeMax = new Bunifu.Framework.UI.BunifuImageButton(); this.buttonVolumeMin = new Bunifu.Framework.UI.BunifuImageButton(); this.buttonPre = new Bunifu.Framework.UI.BunifuImageButton(); this.buttonNext = new Bunifu.Framework.UI.BunifuImageButton(); this.buttonPlay = new Bunifu.Framework.UI.BunifuImageButton(); this.processbarPlayTime = new Bunifu.Framework.UI.BunifuProgressBar(); this.elipseBorder = new Bunifu.Framework.UI.BunifuElipse(this.components); this.dragcontrolMainFrame = new Bunifu.Framework.UI.BunifuDragControl(this.components); this.gradientpanelUpperBar = new Bunifu.Framework.UI.BunifuGradientPanel(); this.buttonMinimize = new Bunifu.Framework.UI.BunifuImageButton(); this.buttonClose = new Bunifu.Framework.UI.BunifuImageButton(); this.panelLeft = new System.Windows.Forms.Panel(); this.separatorLeftMid = new Bunifu.Framework.UI.BunifuSeparator(); this.panelTrackList = new System.Windows.Forms.Panel(); this.panelTitle = new System.Windows.Forms.Panel(); this.buttonSlider = new Bunifu.Framework.UI.BunifuImageButton(); this.pictureboxTitle = new System.Windows.Forms.PictureBox(); this.panelMid = new System.Windows.Forms.Panel(); this.panelBlankTop = new System.Windows.Forms.Panel(); this.buttonClearList = new Bunifu.Framework.UI.BunifuThinButton2(); this.tooltipDescription = new System.Windows.Forms.ToolTip(this.components); this.panelControl.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.buttonShuffle)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonRepeat)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonVolumeMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonVolumeMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonPre)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonNext)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonPlay)).BeginInit(); this.gradientpanelUpperBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.buttonMinimize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonClose)).BeginInit(); this.panelLeft.SuspendLayout(); this.panelTitle.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.buttonSlider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureboxTitle)).BeginInit(); this.panelBlankTop.SuspendLayout(); this.SuspendLayout(); // // panelControl // this.panelControl.Controls.Add(this.sliderVolume); this.panelControl.Controls.Add(this.buttonShuffle); this.panelControl.Controls.Add(this.buttonRepeat); this.panelControl.Controls.Add(this.buttonVolumeMax); this.panelControl.Controls.Add(this.buttonVolumeMin); this.panelControl.Controls.Add(this.buttonPre); this.panelControl.Controls.Add(this.buttonNext); this.panelControl.Controls.Add(this.buttonPlay); this.panelControl.Controls.Add(this.processbarPlayTime); this.panelControl.Dock = System.Windows.Forms.DockStyle.Bottom; this.panelControl.Location = new System.Drawing.Point(0, 416); this.panelControl.Name = "panelControl"; this.panelControl.Size = new System.Drawing.Size(768, 96); this.panelControl.TabIndex = 2; // // sliderVolume // this.sliderVolume.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.sliderVolume.BackColor = System.Drawing.Color.Transparent; this.sliderVolume.BackgroudColor = System.Drawing.Color.SlateGray; this.sliderVolume.BorderRadius = 2; this.sliderVolume.IndicatorColor = System.Drawing.Color.DarkSlateGray; this.sliderVolume.Location = new System.Drawing.Point(559, 41); this.sliderVolume.MaximumValue = 100; this.sliderVolume.Name = "sliderVolume"; this.sliderVolume.Size = new System.Drawing.Size(148, 30); this.sliderVolume.TabIndex = 13; this.tooltipDescription.SetToolTip(this.sliderVolume, "Adjust volume"); this.sliderVolume.Value = 0; // // buttonShuffle // this.buttonShuffle.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonShuffle.BackColor = System.Drawing.Color.Transparent; this.buttonShuffle.Image = global::UIDesign.Properties.Resources.button_noneshuffle_background; this.buttonShuffle.ImageActive = null; this.buttonShuffle.Location = new System.Drawing.Point(191, 35); this.buttonShuffle.Name = "buttonShuffle"; this.buttonShuffle.Size = new System.Drawing.Size(40, 40); this.buttonShuffle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.buttonShuffle.TabIndex = 10; this.buttonShuffle.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonShuffle, "Shuffle mode"); this.buttonShuffle.Zoom = 10; this.buttonShuffle.Click += new System.EventHandler(this.buttonShuffle_Click); this.buttonShuffle.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonShuffle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // buttonRepeat // this.buttonRepeat.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonRepeat.BackColor = System.Drawing.Color.Transparent; this.buttonRepeat.Image = global::UIDesign.Properties.Resources.button_repeatnone_background; this.buttonRepeat.ImageActive = null; this.buttonRepeat.Location = new System.Drawing.Point(111, 35); this.buttonRepeat.Name = "buttonRepeat"; this.buttonRepeat.Size = new System.Drawing.Size(40, 40); this.buttonRepeat.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.buttonRepeat.TabIndex = 9; this.buttonRepeat.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonRepeat, "Repeat mode"); this.buttonRepeat.Zoom = 10; this.buttonRepeat.Click += new System.EventHandler(this.buttonRepeat_Click); this.buttonRepeat.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonRepeat.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // buttonVolumeMax // this.buttonVolumeMax.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonVolumeMax.BackColor = System.Drawing.Color.Transparent; this.buttonVolumeMax.Image = global::UIDesign.Properties.Resources.button_sound_background; this.buttonVolumeMax.ImageActive = null; this.buttonVolumeMax.Location = new System.Drawing.Point(713, 35); this.buttonVolumeMax.Name = "buttonVolumeMax"; this.buttonVolumeMax.Size = new System.Drawing.Size(40, 40); this.buttonVolumeMax.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.buttonVolumeMax.TabIndex = 6; this.buttonVolumeMax.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonVolumeMax, "Maximum volume"); this.buttonVolumeMax.Zoom = 10; this.buttonVolumeMax.Click += new System.EventHandler(this.buttonVolumeMax_Click); this.buttonVolumeMax.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonVolumeMax.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // buttonVolumeMin // this.buttonVolumeMin.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonVolumeMin.BackColor = System.Drawing.Color.Transparent; this.buttonVolumeMin.Image = global::UIDesign.Properties.Resources.button_mute_background; this.buttonVolumeMin.ImageActive = null; this.buttonVolumeMin.Location = new System.Drawing.Point(513, 35); this.buttonVolumeMin.Name = "buttonVolumeMin"; this.buttonVolumeMin.Size = new System.Drawing.Size(40, 40); this.buttonVolumeMin.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.buttonVolumeMin.TabIndex = 5; this.buttonVolumeMin.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonVolumeMin, "Mute volume"); this.buttonVolumeMin.Zoom = 10; this.buttonVolumeMin.Click += new System.EventHandler(this.buttonVolumeMin_Click); this.buttonVolumeMin.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonVolumeMin.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // buttonPre // this.buttonPre.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonPre.BackColor = System.Drawing.Color.Transparent; this.buttonPre.Image = global::UIDesign.Properties.Resources.button_previous_background; this.buttonPre.ImageActive = null; this.buttonPre.Location = new System.Drawing.Point(298, 32); this.buttonPre.Name = "buttonPre"; this.buttonPre.Size = new System.Drawing.Size(48, 48); this.buttonPre.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.buttonPre.TabIndex = 4; this.buttonPre.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonPre, "Previous"); this.buttonPre.Zoom = 10; this.buttonPre.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonPre.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // buttonNext // this.buttonNext.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonNext.BackColor = System.Drawing.Color.Transparent; this.buttonNext.Image = global::UIDesign.Properties.Resources.button_forward_background; this.buttonNext.ImageActive = null; this.buttonNext.Location = new System.Drawing.Point(406, 32); this.buttonNext.Name = "buttonNext"; this.buttonNext.Size = new System.Drawing.Size(48, 48); this.buttonNext.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.buttonNext.TabIndex = 3; this.buttonNext.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonNext, "Next"); this.buttonNext.Zoom = 10; this.buttonNext.Click += new System.EventHandler(this.buttonNext_Click); this.buttonNext.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonNext.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // buttonPlay // this.buttonPlay.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonPlay.BackColor = System.Drawing.Color.Transparent; this.buttonPlay.Image = global::UIDesign.Properties.Resources.button_play_background; this.buttonPlay.ImageActive = null; this.buttonPlay.Location = new System.Drawing.Point(352, 32); this.buttonPlay.Name = "buttonPlay"; this.buttonPlay.Size = new System.Drawing.Size(48, 48); this.buttonPlay.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.buttonPlay.TabIndex = 2; this.buttonPlay.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonPlay, "Play/Pause"); this.buttonPlay.Zoom = 10; this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click); this.buttonPlay.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonPlay.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // processbarPlayTime // this.processbarPlayTime.BackColor = System.Drawing.Color.LightSlateGray; this.processbarPlayTime.BorderRadius = 2; this.processbarPlayTime.Cursor = System.Windows.Forms.Cursors.Hand; this.processbarPlayTime.Dock = System.Windows.Forms.DockStyle.Top; this.processbarPlayTime.Location = new System.Drawing.Point(0, 0); this.processbarPlayTime.MaximumValue = 100; this.processbarPlayTime.Name = "processbarPlayTime"; this.processbarPlayTime.ProgressColor = System.Drawing.Color.DeepSkyBlue; this.processbarPlayTime.Size = new System.Drawing.Size(768, 12); this.processbarPlayTime.TabIndex = 1; this.processbarPlayTime.TabStop = false; this.tooltipDescription.SetToolTip(this.processbarPlayTime, "Timer process"); this.processbarPlayTime.Value = 0; // // elipseBorder // this.elipseBorder.ElipseRadius = 3; this.elipseBorder.TargetControl = this; // // dragcontrolMainFrame // this.dragcontrolMainFrame.Fixed = true; this.dragcontrolMainFrame.Horizontal = true; this.dragcontrolMainFrame.TargetControl = this.gradientpanelUpperBar; this.dragcontrolMainFrame.Vertical = true; // // gradientpanelUpperBar // this.gradientpanelUpperBar.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("gradientpanelUpperBar.BackgroundImage"))); this.gradientpanelUpperBar.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.gradientpanelUpperBar.Controls.Add(this.buttonMinimize); this.gradientpanelUpperBar.Controls.Add(this.buttonClose); this.gradientpanelUpperBar.Dock = System.Windows.Forms.DockStyle.Top; this.gradientpanelUpperBar.GradientBottomLeft = System.Drawing.Color.DeepSkyBlue; this.gradientpanelUpperBar.GradientBottomRight = System.Drawing.Color.LightSeaGreen; this.gradientpanelUpperBar.GradientTopLeft = System.Drawing.Color.DeepSkyBlue; this.gradientpanelUpperBar.GradientTopRight = System.Drawing.Color.LightSeaGreen; this.gradientpanelUpperBar.Location = new System.Drawing.Point(0, 0); this.gradientpanelUpperBar.Name = "gradientpanelUpperBar"; this.gradientpanelUpperBar.Quality = 10; this.gradientpanelUpperBar.Size = new System.Drawing.Size(768, 32); this.gradientpanelUpperBar.TabIndex = 0; this.gradientpanelUpperBar.Paint += new System.Windows.Forms.PaintEventHandler(this.gradientpanelUpperBar_Paint); this.gradientpanelUpperBar.DoubleClick += new System.EventHandler(this.gradientpanelUpperBar_DoubleClick); // // buttonMinimize // this.buttonMinimize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonMinimize.BackColor = System.Drawing.Color.Transparent; this.buttonMinimize.Image = global::UIDesign.Properties.Resources.button_minus_background; this.buttonMinimize.ImageActive = null; this.buttonMinimize.Location = new System.Drawing.Point(703, 0); this.buttonMinimize.Name = "buttonMinimize"; this.buttonMinimize.Size = new System.Drawing.Size(32, 32); this.buttonMinimize.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.buttonMinimize.TabIndex = 1; this.buttonMinimize.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonMinimize, "Minimize to taskbar"); this.buttonMinimize.Zoom = 0; this.buttonMinimize.Click += new System.EventHandler(this.buttonMinimize_Click); this.buttonMinimize.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonMinimize.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // buttonClose // this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonClose.BackColor = System.Drawing.Color.Transparent; this.buttonClose.Image = global::UIDesign.Properties.Resources.button_close_background; this.buttonClose.ImageActive = null; this.buttonClose.Location = new System.Drawing.Point(735, 0); this.buttonClose.Name = "buttonClose"; this.buttonClose.Size = new System.Drawing.Size(32, 32); this.buttonClose.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.buttonClose.TabIndex = 0; this.buttonClose.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonClose, "Close application"); this.buttonClose.Zoom = 0; this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click); this.buttonClose.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonClose.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // panelLeft // this.panelLeft.BackColor = System.Drawing.Color.Transparent; this.panelLeft.Controls.Add(this.separatorLeftMid); this.panelLeft.Controls.Add(this.panelTrackList); this.panelLeft.Controls.Add(this.panelTitle); this.panelLeft.Dock = System.Windows.Forms.DockStyle.Left; this.panelLeft.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.panelLeft.ForeColor = System.Drawing.Color.Black; this.panelLeft.Location = new System.Drawing.Point(0, 32); this.panelLeft.Name = "panelLeft"; this.panelLeft.Size = new System.Drawing.Size(240, 384); this.panelLeft.TabIndex = 3; // // separatorLeftMid // this.separatorLeftMid.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); this.separatorLeftMid.BackColor = System.Drawing.Color.Transparent; this.separatorLeftMid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(130)))), ((int)(((byte)(180))))); this.separatorLeftMid.LineThickness = 1; this.separatorLeftMid.Location = new System.Drawing.Point(238, 0); this.separatorLeftMid.Name = "separatorLeftMid"; this.separatorLeftMid.Size = new System.Drawing.Size(2, 384); this.separatorLeftMid.TabIndex = 2; this.separatorLeftMid.Transparency = 255; this.separatorLeftMid.Vertical = true; // // panelTrackList // this.panelTrackList.AllowDrop = true; this.panelTrackList.AutoScroll = true; this.panelTrackList.BackColor = System.Drawing.Color.Transparent; this.panelTrackList.Cursor = System.Windows.Forms.Cursors.Cross; this.panelTrackList.Dock = System.Windows.Forms.DockStyle.Fill; this.panelTrackList.Location = new System.Drawing.Point(0, 32); this.panelTrackList.Name = "panelTrackList"; this.panelTrackList.Size = new System.Drawing.Size(240, 352); this.panelTrackList.TabIndex = 1; this.tooltipDescription.SetToolTip(this.panelTrackList, "Drag your files here to open them"); this.panelTrackList.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelTrackList_DragDrop); this.panelTrackList.DragEnter += new System.Windows.Forms.DragEventHandler(this.panelTrackList_DragEnter); // // panelTitle // this.panelTitle.Controls.Add(this.buttonSlider); this.panelTitle.Controls.Add(this.pictureboxTitle); this.panelTitle.Dock = System.Windows.Forms.DockStyle.Top; this.panelTitle.Location = new System.Drawing.Point(0, 0); this.panelTitle.Name = "panelTitle"; this.panelTitle.Size = new System.Drawing.Size(240, 32); this.panelTitle.TabIndex = 0; // // buttonSlider // this.buttonSlider.BackColor = System.Drawing.Color.Transparent; this.buttonSlider.Dock = System.Windows.Forms.DockStyle.Left; this.buttonSlider.Image = global::UIDesign.Properties.Resources.button_menu_background; this.buttonSlider.ImageActive = null; this.buttonSlider.Location = new System.Drawing.Point(0, 0); this.buttonSlider.Name = "buttonSlider"; this.buttonSlider.Size = new System.Drawing.Size(48, 32); this.buttonSlider.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.buttonSlider.TabIndex = 6; this.buttonSlider.TabStop = false; this.tooltipDescription.SetToolTip(this.buttonSlider, "About me"); this.buttonSlider.Zoom = 10; this.buttonSlider.Click += new System.EventHandler(this.buttonSlider_Click); this.buttonSlider.MouseLeave += new System.EventHandler(this.button_MouseLeave); this.buttonSlider.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button_MouseMove); // // pictureboxTitle // this.pictureboxTitle.Dock = System.Windows.Forms.DockStyle.Right; this.pictureboxTitle.Image = global::UIDesign.Properties.Resources.picture_title_background; this.pictureboxTitle.Location = new System.Drawing.Point(48, 0); this.pictureboxTitle.Name = "pictureboxTitle"; this.pictureboxTitle.Size = new System.Drawing.Size(192, 32); this.pictureboxTitle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureboxTitle.TabIndex = 0; this.pictureboxTitle.TabStop = false; // // panelMid // this.panelMid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panelMid.BackColor = System.Drawing.Color.Transparent; this.panelMid.Location = new System.Drawing.Point(240, 64); this.panelMid.Name = "panelMid"; this.panelMid.Size = new System.Drawing.Size(528, 352); this.panelMid.TabIndex = 4; // // panelBlankTop // this.panelBlankTop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panelBlankTop.BackColor = System.Drawing.Color.Transparent; this.panelBlankTop.Controls.Add(this.buttonClearList); this.panelBlankTop.Location = new System.Drawing.Point(240, 32); this.panelBlankTop.Name = "panelBlankTop"; this.panelBlankTop.Size = new System.Drawing.Size(528, 32); this.panelBlankTop.TabIndex = 5; // // buttonClearList // this.buttonClearList.ActiveBorderThickness = 1; this.buttonClearList.ActiveCornerRadius = 2; this.buttonClearList.ActiveFillColor = System.Drawing.Color.DarkCyan; this.buttonClearList.ActiveForecolor = System.Drawing.Color.White; this.buttonClearList.ActiveLineColor = System.Drawing.Color.DarkCyan; this.buttonClearList.BackColor = System.Drawing.Color.Transparent; this.buttonClearList.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonClearList.BackgroundImage"))); this.buttonClearList.ButtonText = "Clear list"; this.buttonClearList.Cursor = System.Windows.Forms.Cursors.Default; this.buttonClearList.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonClearList.ForeColor = System.Drawing.Color.DarkSlateGray; this.buttonClearList.IdleBorderThickness = 1; this.buttonClearList.IdleCornerRadius = 2; this.buttonClearList.IdleFillColor = System.Drawing.Color.LightCyan; this.buttonClearList.IdleForecolor = System.Drawing.Color.DarkCyan; this.buttonClearList.IdleLineColor = System.Drawing.Color.DarkCyan; this.buttonClearList.Location = new System.Drawing.Point(8, 0); this.buttonClearList.Margin = new System.Windows.Forms.Padding(5); this.buttonClearList.Name = "buttonClearList"; this.buttonClearList.Size = new System.Drawing.Size(64, 32); this.buttonClearList.TabIndex = 0; this.buttonClearList.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.tooltipDescription.SetToolTip(this.buttonClearList, "Clear all loaded files"); this.buttonClearList.Click += new System.EventHandler(this.buttonClearList_Click); // // tooltipDescription // this.tooltipDescription.AutoPopDelay = 3000; this.tooltipDescription.BackColor = System.Drawing.Color.White; this.tooltipDescription.ForeColor = System.Drawing.Color.DarkSlateGray; this.tooltipDescription.InitialDelay = 500; this.tooltipDescription.ReshowDelay = 100; this.tooltipDescription.ToolTipTitle = "Hint"; // // formMainFrame // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(768, 512); this.Controls.Add(this.panelBlankTop); this.Controls.Add(this.panelMid); this.Controls.Add(this.panelLeft); this.Controls.Add(this.panelControl); this.Controls.Add(this.gradientpanelUpperBar); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MinimumSize = new System.Drawing.Size(400, 300); this.Name = "formMainFrame"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Media Play"; this.Load += new System.EventHandler(this.formMainFrame_Load); this.panelControl.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.buttonShuffle)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonRepeat)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonVolumeMax)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonVolumeMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonPre)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonNext)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonPlay)).EndInit(); this.gradientpanelUpperBar.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.buttonMinimize)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.buttonClose)).EndInit(); this.panelLeft.ResumeLayout(false); this.panelTitle.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.buttonSlider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureboxTitle)).EndInit(); this.panelBlankTop.ResumeLayout(false); this.ResumeLayout(false); }
/** * Tour suivant : Calcul des attributs des personnages et mise à jour des User_Controls. * Vérification si le crunch est activé ou non, random qui détermine si un personnage * tombe malade. */ private void btnTourSuivant_Click(object sender, EventArgs e) { uC_Personnage1.arreterClignotant(); uC_Personnage2.arreterClignotant(); uC_Personnage3.arreterClignotant(); uC_Personnage4.arreterClignotant(); lblTour.Visible = true; btnReunion.Enabled = true; btnRepos.Enabled = true; if (crunchBool == true) { foreach (Object o in Controls) { if (o is Panel) { Panel p = (Panel)o; foreach (Object c in p.Controls) { if (c is UC_Personnage) { UC_Personnage up = (UC_Personnage)c; up.Enabled = true; up.crunchDesactive(); crunchBool = false; } } } } } // FIN SI DEADLINE OU TOUTES LES FONCTIONS SONT FINIES // A REVOIR ( VERIFIER SI LE POURCENTAGE DU PROJET == 100 --> FIN ) if ((nbTour >= nbTourMax) || ((ControleurJeu.verifierTacheTermine()))) { if (ControleurJeu.verifierTacheTermine()) { ControleurJeu.arreterJeu(rtbListeF.Text, 0); this.Close(); } ControleurJeu.arreterJeu(rtbListeF.Text); this.Close(); } // Pre remplissage de toutes les taches pour le tour actuel pour chaque perso foreach (Object o in Controls) { if (o is Panel) { Panel p = (Panel)o; foreach (Object c in p.Controls) { if (c is UC_Personnage) { UC_Personnage up = (UC_Personnage)c; up.remplirListeAffinite(); } } } } //modification des taches des user controls foreach (Object o in Controls) { if (o is Panel) { Panel p = (Panel)o; foreach (Object c in p.Controls) { if (c is UC_Personnage) { UC_Personnage up = (UC_Personnage)c; up.donnerTachePerso(); } } } } foreach (Object o in Controls) { if (o is Panel) { Panel p = (Panel)o; foreach (Object c in p.Controls) { if (c is UC_Personnage) { UC_Personnage up = (UC_Personnage)c; up.viderListeAffinite(); } } } } try { // REMPLISSAGE DEUXIEME "CONSOLE" rtbListeF.Text += "\nJournée " + nbTour.ToString() + ":\n"; rtbListeF.Text += s; s = ""; // MISE A ZERO DES COMBOBOX POUR NE PLUS AVOIR LES ANCIENS CHOIX foreach (Object o in Controls) { if (o is Panel) { Panel p = (Panel)o; foreach (Object c in p.Controls) { if (c is UC_Personnage) { UC_Personnage up = (UC_Personnage)c; up.cleanCBO(); } } } } ControleurJeu.nouveauTour(); this.augmenterNbTour(); //incremente nb de tour lblTour.Text = "Tour : " + nbTour.ToString() + " / " + nbTourMax.ToString(); ArrayList listPerso = ControleurJeu.getListePersonnage(); Personnage p1 = (Personnage)listPerso[0]; Personnage p2 = (Personnage)listPerso[1]; Personnage p3 = (Personnage)listPerso[2]; Personnage p4 = (Personnage)listPerso[3]; //mise a jour des persos apres avoir effectue les taches initUC(uC_Personnage1, p1); initUC(uC_Personnage2, p2); initUC(uC_Personnage3, p3); initUC(uC_Personnage4, p4); List <UC_Personnage> listUC = new List <UC_Personnage>(); listUC.Add(uC_Personnage1); listUC.Add(uC_Personnage2); listUC.Add(uC_Personnage3); listUC.Add(uC_Personnage4); uC_Personnage1.cleanCBO(); uC_Personnage2.cleanCBO(); uC_Personnage3.cleanCBO(); uC_Personnage4.cleanCBO(); Random rnd = new Random(); int alea = rnd.Next(20); if (alea <= 3) { UC_Personnage u = listUC[alea]; u.getPersonnage().setMalade(true); u.getPersonnage().setDisponible(false); } // FIN SI DEADLINE OU TOUTES LES FONCTIONS SONT FINIES // A REVOIR ( VERIFIER SI LE POURCENTAGE DU PROJET == 100 --> FIN ) } catch (NullReferenceException) { MessageBox.Show("Selectionnez Action"); } //Mettre à jour la liste des tâches à effectuer, c'est-à-dire que l'on vérifie si la tâche est complété ou non. Si c'est le cas alors on l'enlève de la liste lstTache.Items.Clear(); foreach (Fonctionnalites f in ControleurJeu.getListeFonctionnalite()) { if (f.getPaDepense() < f.getPaNecess() && f.getStatus() == false) { lstTache.Items.Add(f.getNom() + " (" + f.getNvConnaissNecces() + ")"); } } //Actualiser les progressBars pour chaque tache ArrayList listFonctionnalite = ControleurJeu.getListeFonctionnalite(); for (int i = 0; i <= listFonctionnalite.Count - 1; i++) { foreach (Object o in Controls) { if (o is Panel) { Panel p = (Panel)o; foreach (Object ob in p.Controls) { if (ob is Bunifu.Framework.UI.BunifuProgressBar) { Bunifu.Framework.UI.BunifuProgressBar pb = (Bunifu.Framework.UI.BunifuProgressBar)ob; if ((int)pb.Tag == i) { Fonctionnalites f = (Fonctionnalites)listFonctionnalite[i]; foreach (Fonctionnalites ft in ControleurJeu.getListeFonctionnalite()) { if (f.getNom() == ft.getNom()) { float val1 = (float)ft.getPaDepense(); float val2 = (float)ft.getPaNecess(); float res = (val1 / val2) * 100; if (res >= 100) { res = 100; } pb.Value = (int)res; } } } } } } } } }
/** * Assignation des personnages aux User_Controls, affichage de tous les labels et des progress bar * qui sont générés dynamiquement. */ public frmJeu(Personnage p1, Personnage p2, Personnage p3, Personnage p4, int tourmax) { InitializeComponent(); nbTourMax = tourmax; int screenWidth = Screen.PrimaryScreen.Bounds.Width; int screenHeight = Screen.PrimaryScreen.Bounds.Height; this.Size = new Size(screenWidth, screenHeight); lblTacheReal.Size = new Size(((screenWidth - lblTacheReal.Location.X) - lblTacheReal.Size.Width) + lblTacheReal.Size.Width, lblTacheReal.Size.Height - 5); pnlProgressBarTache.Size = new Size(((screenWidth - pnlProgressBarTache.Location.X) - pnlProgressBarTache.Size.Width) + pnlProgressBarTache.Size.Width, pnlProgressBarTache.Size.Height - 5); panel2.Size = new Size(screenWidth, panel2.Height); foreach (Fonctionnalites f in ControleurJeu.getListeFonctionnalite()) { if (f.getPaDepense() < f.getPaNecess() && f.getStatus() == false) { lstTache.Items.Add(f.getNom() + " (" + f.getNvConnaissNecces() + ")"); } } lstTache.AllowDrop = true; uC_Personnage1.AllowDrop = true; uC_Personnage2.AllowDrop = true; uC_Personnage3.AllowDrop = true; uC_Personnage4.AllowDrop = true; this.Refresh(); listPersonnage.Clear(); crunchBool = false; ArrayList listPerso = ControleurJeu.getListePersonnage(); listPersonnage.Add(p1); listPersonnage.Add(p2); listPersonnage.Add(p3); listPersonnage.Add(p4); initUC(uC_Personnage1, p1); initUC(uC_Personnage2, p2); initUC(uC_Personnage3, p3); initUC(uC_Personnage4, p4); foreach (Object o in Controls) { if (o is UC_Personnage) { UC_Personnage uC_Perso = new UC_Personnage(); uC_Perso.Enabled = true; } } ArrayList listTache = ControleurJeu.getListeFonctionnalite(); int posBas = 5; Fonctionnalites fPrecedent = null; //Initialisation ProgressBar pour chaque tache for (int i = 0; i <= listTache.Count - 1; i++) { Bunifu.Framework.UI.BunifuProgressBar progressBar = new Bunifu.Framework.UI.BunifuProgressBar(); Label l = new Label(); Fonctionnalites f = (Fonctionnalites)listTache[i]; if (f.getNom() != "Formation") { if (fPrecedent == null || f.getType() != fPrecedent.getType()) { posBas += 25; Label lblaffichageType = new Label(); lblaffichageType.Text = f.getType(); lblaffichageType.Location = new System.Drawing.Point(0, posBas); lblaffichageType.Font = new System.Drawing.Font("Cooper Black", 19F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lblaffichageType.Size = new System.Drawing.Size(200, 45); lblaffichageType.Tag = 10; //permet d'identifier les labels titres posBas += 50; pnlProgressBarTache.Controls.Add(lblaffichageType); } fPrecedent = f; //remet à jour la fonctionnalités précédente l.Font = new System.Drawing.Font("Cooper Black", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); l.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; l.BackColor = pnlProgressBarTache.BackColor; l.Location = new System.Drawing.Point(0, posBas); l.Size = new System.Drawing.Size(220, 20); l.Text = f.getNom(); if (f.getType() == "Spécification") { l.ForeColor = Color.DarkRed; } if (f.getType() == "Concevoir") { l.ForeColor = Color.Green; } if (f.getType() == "Développer") { l.ForeColor = Color.Purple; } if (f.getType() == "Recette") { l.ForeColor = Color.DarkGray; } if (f.getType() == "Livraison") { l.ForeColor = Color.Maroon; } progressBar.BackColor = System.Drawing.Color.Silver; progressBar.BorderRadius = 5; progressBar.ProgressColor = System.Drawing.Color.Teal; progressBar.Size = new System.Drawing.Size(pnlProgressBarTache.Width - 200, 20); progressBar.Location = new System.Drawing.Point(l.Location.X + 200, l.Location.Y); progressBar.Tag = i; progressBar.Value = 0; pnlProgressBarTache.Controls.Add(progressBar); pnlProgressBarTache.Controls.Add(l); posBas += 25; } } }
public void getDiagnosticPanel(Panel DiagnosticPanel) { DriveInfo[] drives = DriveInfo.GetDrives(); int startWidth = 10; int progressBarStartWidth = 82; int driverID = 1; foreach (DriveInfo driver in drives) { PictureBox actualDrive = new PictureBox(); actualDrive.Parent = DiagnosticPanel; Label actualDriveText = new Label(); Bunifu.Framework.UI.BunifuProgressBar diskSpace = new Bunifu.Framework.UI.BunifuProgressBar(); diskSpace.BringToFront(); diskSpace.ProgressColor = System.Drawing.Color.FromArgb(255, 90, 0); diskSpace.BackColor = Color.Black; actualDrive.Name = "actualDrive" + driverID; actualDriveText.Text = "Drive name: " + driver.Name + "\nType: " + driver.DriveType; if (driver.DriveType.ToString() == "Fixed") { DirectoryInfo dirs = new DirectoryInfo(driver.Name.ToString()); DirectoryInfo [] getDirs = dirs.GetDirectories(); foreach (DirectoryInfo dirname in getDirs) { if (dirname.Name == "Windows") { actualDrive.Image = Properties.Resources.win; continue; } else { actualDrive.Image = Properties.Resources.hdd; } } double total = Convert.ToDouble(driver.TotalSize); double free = Convert.ToDouble(driver.TotalFreeSpace); diskSpace.Value = 100 - (int)Math.Ceiling(free / total * 100); actualDriveText.Text += "\n" + CalcSpace(driver.TotalFreeSpace, driver.TotalSize); } if (driver.DriveType.ToString() == "Removable") { actualDrive.Image = Properties.Resources.usb; double total = Convert.ToDouble(driver.TotalSize); double free = Convert.ToDouble(driver.TotalFreeSpace); diskSpace.Value = 100 - (int)Math.Ceiling(free / total * 100); actualDriveText.Text += "\n " + CalcSpace(driver.TotalFreeSpace, driver.TotalSize); } if (driver.DriveType.ToString() == "CDRom") { actualDrive.Image = Properties.Resources.cd; if (driver.IsReady) { actualDriveText.Text += "\n\n Disk inside"; } else { actualDriveText.Text += "\n\n Empty drive"; } } actualDrive.Location = new Point(startWidth, 40); actualDrive.Visible = true; actualDrive.Width = 75; actualDrive.Height = 63; actualDriveText.Location = new Point(startWidth + 80, 40); actualDriveText.Width = 150; actualDriveText.Height = 63; actualDriveText.ForeColor = Color.White; diskSpace.Location = new Point(startWidth + 82, 70); diskSpace.Width = 130; diskSpace.Height = 8; DiagnosticPanel.Controls.Add(actualDrive); DiagnosticPanel.Controls.Add(actualDriveText); DiagnosticPanel.Controls.Add(diskSpace); driverID++; startWidth += 230; progressBarStartWidth += 230; actualDriveText.SendToBack(); } }