private void SetInitValues() { RegHelper reg = new RegHelper(); watchLog = reg.WatchLog; eventFilter = reg.EventFilter; syslogport = reg.SyslogPort; syslogserver = reg.SyslogServer; syslogServer.Text = syslogserver; _syslogPort.Text = syslogport; appIcon = new Icon(GetType(), "events.ico"); localPath = System.Environment.CurrentDirectory; this.WindowState = FormWindowState.Minimized; this.Hide(); this.metroButton1.Image = IconChar.AngleDown.ToBitmap(22, Color.Black); this.iconPictureBox1.Image = IconChar.AngleDown.ToBitmap(22, Color.Black); if (!string.IsNullOrEmpty(watchLog)) { this.logsSelectedBox.Text = "Not Listening to Logs. Set logs to watch."; } this.logsSelectedBox.Text = watchLog; // populate monitorLogs with available event logs ArrayList alLogs = GetAvailEventLogs(); foreach (EventLog log in GetAvailEventLogs()) { MetroFramework.Controls.MetroCheckBox checkBox = new MetroFramework.Controls.MetroCheckBox(); checkBox.Text = log.LogDisplayName; logsCheckBox.Items.Add(log.LogDisplayName); } logsCheckBox.SelectedIndex = 0; NotifyIcon = new NotifyIconEx(); NotifyIcon.Icon = this.appIcon; NotifyIcon.Text = tipText + "(" + watchLog + ")"; NotifyIcon.Visible = true; NotifyIcon.ContextMenu = this.contextMenu; logsCheckBox.SelectedItem = watchLog; // add event handlers NotifyIcon.BalloonClick += new EventHandler(OnClickBalloon); NotifyIcon.DoubleClick += new EventHandler(OnDoubleClickIcon); }
public CurveEditDialog(PlayCanvas_Curve_PropertyEditor propertyEditor) { if (propertyEditor == null) throw new ArgumentNullException("`propertyEditor` argument cannot be null!"); m_activeCurve = -1; m_activeKey = -1.0f; m_zoomOut = 1.0f; m_propertyEditor = propertyEditor; m_info = m_propertyEditor.Info == null ? new PlayCanvas_Curve_PropertyEditor.CurveInfo() : m_propertyEditor.Info; if (m_info.Curves != null && m_info.Curves.Length > 0) { m_curveSet = m_propertyEditor.PropertyModel.Data<PlayCanvas.CurveSet>(); if (m_curveSet == null) m_curveSet = new PlayCanvas.CurveSet(); if (m_curveSet.CurvesList.Count < m_info.Curves.Length) for (int i = m_curveSet.CurvesList.Count; i < m_info.Curves.Length; ++i) m_curveSet.CurvesList.Add(new PlayCanvas.Curve(new float[] { 0.0f, 0.0f })); } else { m_curve = m_propertyEditor.PropertyModel.Data<PlayCanvas.Curve>(); if (m_curve == null) m_curve = new PlayCanvas.Curve(); if (m_curve.KeyFrames.Count == 0) m_curve.KeyFrames.Add(0.0f, 0.0f); float diff = Math.Max(Math.Abs(m_info.Max), Math.Abs(m_info.Min)); while (m_zoomOut < diff) m_zoomOut *= 2.0f; } ValidateCurve(); MetroSkinManager.ApplyMetroStyle(this); Size = new Size(640, 480); MinimumSize = new Size(480, 320); Text = (m_curve == null ? "Edit curve set: " : "Edit curve: ") + propertyEditor.PropertyModel.Name; FormClosed += CurveEditDialog_FormClosed; m_editPictureBox = new PictureBox(); m_editPictureBox.Dock = DockStyle.Fill; m_editPictureBox.BackColor = Color.FromArgb(255, 64, 64, 64); m_editPictureBox.Resize += m_editPictureBox_Resize; m_editPictureBox.Paint += m_editPictureBox_Paint; m_editPictureBox.MouseEnter += m_editPictureBox_MouseEnter; m_editPictureBox.MouseDown += m_editPictureBox_MouseDown; m_editPictureBox.MouseUp += m_editPictureBox_MouseUp; m_editPictureBox.MouseMove += m_editPictureBox_MouseMove; m_editPictureBox.MouseWheel += m_editPictureBox_MouseWheel; Controls.Add(m_editPictureBox); m_editPictureBox.Refresh(); MetroPanel topToolbar = new MetroPanel(); MetroSkinManager.ApplyMetroStyle(topToolbar); topToolbar.Width = 0; topToolbar.Height = 30; topToolbar.Dock = DockStyle.Top; Controls.Add(topToolbar); MetroLabel typeLabel = new MetroLabel(); MetroSkinManager.ApplyMetroStyle(typeLabel); typeLabel.Width = 0; typeLabel.Height = 0; typeLabel.AutoSize = true; typeLabel.Dock = DockStyle.Left; typeLabel.Text = "Type:"; if (m_curveSet != null) { m_curvesCheckBoxes = new List<MetroCheckBox>(); foreach (var name in m_info.Curves) { MetroCheckBox checkBox = new MetroCheckBox(); MetroSkinManager.ApplyMetroStyle(checkBox); checkBox.Width = 0; checkBox.AutoSize = true; checkBox.Checked = true; checkBox.Text = name; checkBox.Dock = DockStyle.Right; checkBox.CheckedChanged += checkBox_CheckedChanged; topToolbar.Controls.Add(checkBox); m_curvesCheckBoxes.Add(checkBox); } } m_typeComboBox = new MetroComboBox(); MetroSkinManager.ApplyMetroStyle(m_typeComboBox); m_typeComboBox.Dock = DockStyle.Left; m_typeComboBox.BindingContext = new BindingContext(); m_typeComboBox.DataSource = Enum.GetNames(typeof(PlayCanvas.Curve.CurveType)); if (m_curve != null) m_typeComboBox.SelectedItem = Enum.GetName(typeof(PlayCanvas.Curve.CurveType), m_curve.Type); else if (m_curveSet != null) m_typeComboBox.SelectedItem = Enum.GetName(typeof(PlayCanvas.Curve.CurveType), m_curveSet.Type); m_typeComboBox.SelectedValueChanged += m_typeComboBox_SelectedValueChanged; topToolbar.Controls.Add(m_typeComboBox); topToolbar.Controls.Add(typeLabel); MetroPanel bottomToolbar = new MetroPanel(); MetroSkinManager.ApplyMetroStyle(bottomToolbar); bottomToolbar.Width = 0; bottomToolbar.Height = 24; bottomToolbar.Dock = DockStyle.Bottom; Controls.Add(bottomToolbar); MetroLabel keyLabel = new MetroLabel(); MetroSkinManager.ApplyMetroStyle(keyLabel); keyLabel.Width = 0; keyLabel.Height = 0; keyLabel.AutoSize = true; keyLabel.Dock = DockStyle.Left; keyLabel.Text = "Key frame:"; m_keyTextBox = new MetroTextBox(); MetroSkinManager.ApplyMetroStyle(m_keyTextBox); m_keyTextBox.Width = 100; m_keyTextBox.Dock = DockStyle.Left; m_keyTextBox.TextChanged += m_keyTextBox_TextChanged; m_keyTextBox.CustomPaintForeground += m_keyTextBox_CustomPaintForeground; m_keyTextBox.Leave += m_keyTextBox_Leave; MetroLabel valueLabel = new MetroLabel(); MetroSkinManager.ApplyMetroStyle(valueLabel); valueLabel.Width = 0; valueLabel.Height = 0; valueLabel.AutoSize = true; valueLabel.Dock = DockStyle.Left; valueLabel.Text = "Value:"; m_valueTextBox = new MetroTextBox(); MetroSkinManager.ApplyMetroStyle(m_valueTextBox); m_valueTextBox.Width = 100; m_valueTextBox.Dock = DockStyle.Left; m_valueTextBox.TextChanged += m_valueTextBox_TextChanged; m_valueTextBox.CustomPaintForeground += m_valueTextBox_CustomPaintForeground; m_valueTextBox.Leave += m_valueTextBox_Leave; MetroButton resetButton = new MetroButton(); MetroSkinManager.ApplyMetroStyle(resetButton); resetButton.Width = 0; resetButton.AutoSize = true; resetButton.Dock = DockStyle.Right; resetButton.Text = m_curve == null ? "Reset visible curves" : "Reset curve"; resetButton.Click += resetButton_Click; bottomToolbar.Controls.Add(resetButton); bottomToolbar.Controls.Add(m_valueTextBox); bottomToolbar.Controls.Add(valueLabel); bottomToolbar.Controls.Add(m_keyTextBox); bottomToolbar.Controls.Add(keyLabel); }