public Notification(string url, FileTypeEnum fileType) { InitializeComponent(); StartPosition = FormStartPosition.Manual; Location = new Point(Screen.PrimaryScreen.WorkingArea.Right - Width, Screen.PrimaryScreen.WorkingArea.Height - Height); Closing += Notification_Closing; _animator = new FormAnimator(this); _animator.Direction = FormAnimator.AnimationDirection.Up; _animator.Method = FormAnimator.AnimationMethod.Slide; _animator.Duration = 500; metroLink1.Text = url; metroLabel1.Text = fileType switch { FileTypeEnum.Image => "Image Uploaded!", FileTypeEnum.Text => "Text Uploaded!", FileTypeEnum.Video => "Recording Uploaded!", FileTypeEnum.Audio => "Audio Uploaded!", FileTypeEnum.Archive => "Archive Uploaded", FileTypeEnum.Document => "Document Uploaded!", FileTypeEnum.Pdf => "Pdf Uploaded!", _ => "Uploaded!" }; } void Notification_Closing(object sender, CancelEventArgs e) { if (_animatingout == false) { e.Cancel = true; _animatingout = true; Close(); } }
/// <summary> /// /// </summary> /// <param name="title"></param> /// <param name="body"></param> /// <param name="duration"></param> /// <param name="animation"></param> /// <param name="direction"></param> public Notification(string title, string body, int duration, FormAnimator.AnimationMethod animation, FormAnimator.AnimationDirection direction, int scale = -1, string issue = "") { InitializeComponent(); if (duration < 0) { duration = int.MaxValue; } else { duration = duration * 1000; } lifeTimer.Interval = duration; labelTitle.Text = title; labelBody.Text = body; labelTime.Text = DateTime.Now.ToShortTimeString(); if (scale == -1) { scale = Setting.Value.Notification_Scale; } this.Scale(new SizeF((float)(scale) / 100, (float)(scale) / 100)); animation = FormAnimator.AnimationMethod.Slide; _animator = new FormAnimator(this, animation, direction, AnimationSpeed); Region = Region.FromHrgn(NativeMethods.CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 2, 2)); Direction = direction; Issue = issue; }
public BuildLibraryNotification(String libraryName) { InitializeComponent(); _libraryName = libraryName; LibraryNameLabel.Text = string.Format(Resources.BuildLibraryNotification_BuildLibraryNotification_Library__0__, _libraryName); var showParams = new FormAnimator.AnimationParams( FormAnimator.AnimationMethod.slide, FormAnimator.AnimationDirection.up, 0); var hideParams = new FormAnimator.AnimationParams( FormAnimator.AnimationMethod.blend, FormAnimator.AnimationDirection.up, 0); _animator = new FormAnimator(this, showParams, hideParams) { ShowParams = { Duration = ANIMATION_DURATION } }; // Not sure why this is necessary, but sometimes the form doesn't // appear without it. Opacity = 1; _displayTimer = new Timer(); _displayTimer.Tick += OnDisplayTimerEvent; _displayTimer.Interval = DISPLAY_DURATION; }
private void btnAnimator_Click(object sender, EventArgs e) { FrmAnimator dlg = new FrmAnimator(); FormAnimator animator = new FormAnimator(dlg, AnimationMethod.Centre, AnimationDirection.Left, 1000); dlg.Show(); }
private void toolStripButton数据字典_Click(object sender, EventArgs e) { Form数据字典 ZiDianGuanLi = new Form数据字典(); FormAnimator animator = new FormAnimator(ZiDianGuanLi, FormAnimator.AnimationMethod.Centre, FormAnimator.AnimationDirection.Left, 500); ZiDianGuanLi.ShowDialog(); }
public toastform(string filename) : this() { this._FileNameToHandle = filename; //Set the time for which the form should be displayed. this.lifeTimer.Interval = 10000; //Display the form by sliding up. this.m_Animator = new FormAnimator(this, FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Up, 400); }
public FormAnimation() { InitializeComponent(); FormAnimator.AnimationMethod animation = FormAnimator.AnimationMethod.Slide; FormAnimator.AnimationDirection direction = FormAnimator.AnimationDirection.Right; _animator = new FormAnimator(this, animation, direction, 500); this.Shown += FormAnimation_Shown; }
//Animates the form automatically when it is loaded. private void m_Form_Load(object sender, System.EventArgs e) { //MDI child forms do not support transparency so do not try to use the Blend method. if (this.m_Form.MdiParent == null || this.m_Method != AnimationMethod.Blend) { //Activate the form. FormAnimator.AnimateWindow(this.m_Form.Handle, this.m_Duration, (int)FormAnimator.AW_ACTIVATE | (int)this.m_Method | (int)this.m_Direction); } }
private void trackBarNmlFactor_ValueChanged(object sender, EventArgs e) { try { FormAnimator dstFormAnim = null; string animatorName = Editor.Parser.m_Name.Substring(0, Editor.Parser.m_Name.Length - 4); List <DockContent> formAnimators; if (Gui.Docking.DockContents.TryGetValue(typeof(FormAnimator), out formAnimators)) { foreach (var form in formAnimators) { FormAnimator formAnim = (FormAnimator)form; AnimatorEditor ed = formAnim.Editor; if (ed.Parser.m_GameObject.instance.m_Name.StartsWith(animatorName)) { dstFormAnim = formAnim; break; } } } if (dstFormAnim == null) { return; } float blendFactor = trackBarNmlFactor.Value / (trackBarNmlFactor.Maximum - 1f); foreach (ListViewItem item in dstFormAnim.listViewMesh.SelectedItems) { int id = (int)item.Tag; MeshRenderer meshR = dstFormAnim.Editor.Meshes[id]; RenderObjectUnity renderObj = dstFormAnim.renderObjectMeshes[id]; foreach (var param in Editor.Parser.Param) { if (param.ObjectName == meshR.m_GameObject.instance.m_Name) { if (blendFactor <= 1) { renderObj.SetNmlParam(param, blendFactor); } else { renderObj.ResetNormalsAndUVs(meshR); } break; } } } Gui.Renderer.Render(); } catch (Exception ex) { Utility.ReportException(ex); } }
//Animates the form automatically when it closes. private void m_Form_Closing(object sender, System.ComponentModel.CancelEventArgs e) // ERROR: Handles clauses are not supported in C# { if (!e.Cancel) { //MDI child forms do not support transparency so do not try to use the Blend method. if (this.m_Form.MdiParent == null || this.m_Method != AnimationMethod.Blend) { //Hide the form. FormAnimator.AnimateWindow(this.m_Form.Handle, this.m_Duration, (int)FormAnimator.AW_HIDE | (int)this.m_Method | (int)AnimationDirection.Down); } } }
public toastform(skImage ic) : this() { this._skImageToHandle = ic; //Set the time for which the form should be displayed. this.lifeTimer.Interval = mySettings.ToastFormTimer; //Attach this form to the Formanimator. //The FormAnimator now has a reference to this toastform. //When the load() of this form is invoked, the Form animator intercepts it and displays the form. this.m_Animator = new FormAnimator(this, FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Up, 400); // this.m_Animator.Dispose(); }
private FormAnimator GetFormAnimatorFromParserName(out List <DockContent> formAnimators) { FormAnimator dstFormAnim = null; string animatorName = Editor.Parser.m_Name.Substring(0, Editor.Parser.m_Name.Length - 4); if (Gui.Docking.DockContents.TryGetValue(typeof(FormAnimator), out formAnimators)) { foreach (var form in formAnimators) { FormAnimator formAnim = (FormAnimator)form; AnimatorEditor ed = formAnim.Editor; if (ed.Parser.m_GameObject.instance.m_Name.StartsWith(animatorName)) { dstFormAnim = formAnim; break; } } } if (dstFormAnim == null) { foreach (var form in formAnimators) { FormAnimator formAnim = (FormAnimator)form; AnimatorEditor ed = formAnim.Editor; int matchingMeshes = 0; foreach (ListViewItem item in listViewNmlMeshes.SelectedItems) { var obj = Editor.GenericMonos[(int)item.Tag]; if (ed.GetMeshRendererId(obj.ObjectName) >= 0) { matchingMeshes++; } } if (matchingMeshes == listViewNmlMeshes.SelectedItems.Count) { dstFormAnim = formAnim; Report.ReportLog("Warning! Using Animator " + dstFormAnim.Text + " although it has a mismatching name."); break; } } if (dstFormAnim == null) { throw new Exception("No Animator beginning with " + Editor.Parser.m_Name.Substring(0, Editor.Parser.m_Name.Length - 4) + " has been opened."); } } return(dstFormAnim); }
public Notification(IssueTimeTracker.Classes.Messenger.Message message) { InitializeComponent(); lifeTimer.Interval = int.MaxValue; labelTitle.Text = "Message from " + JiraIssueBrowser.FixJiraName(message.From); labelBody.Text = message.LongMessage; labelTime.Text = message.TimeSent; this.Scale(new SizeF((float)(Setting.Value.Notification_Scale) / 100, (float)(Setting.Value.Notification_Scale) / 100)); _animator = new FormAnimator(this, FormAnimator.AnimationMethod.Slide, Directions[Setting.Value.Notification_Direction], AnimationSpeed); Region = Region.FromHrgn(NativeMethods.CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 2, 2)); Direction = Directions[Setting.Value.Notification_Direction]; }
public ErrorNotification(FileShell failedImg, FileTypeEnum fileType, bool allowReUpload, string uploader, string errorMessage) { InitializeComponent(); StartPosition = FormStartPosition.Manual; Location = new Point(Screen.PrimaryScreen.WorkingArea.Right - Width, Screen.PrimaryScreen.WorkingArea.Height - Height); Closing += ErrorNotification_Closing; _animator = new FormAnimator(this); _animator.Direction = FormAnimator.AnimationDirection.Up; _animator.Method = FormAnimator.AnimationMethod.Slide; _animator.Duration = 500; if (!allowReUpload) { retryButton.Visible = false; } metroLabel2.Text = (fileType == FileTypeEnum.Video ? "There was an error while uploading your recording." : "There was an error while uploading your screenshot."); }
//Animates the form automatically when it is shown or hidden. private void m_Form_VisibleChanged(object sender, System.EventArgs e) // ERROR: Handles clauses are not supported in C# { //Do not attempt to animate MDI child forms while showing or hiding as they do not behave as expected. if (this.m_Form.MdiParent == null) { int flags = (int)this.m_Method | (int)this.m_Direction; if (this.m_Form.Visible) { //Activate the form. flags = flags | FormAnimator.AW_ACTIVATE; } else { //Hide the form. flags = flags | FormAnimator.AW_HIDE; } FormAnimator.AnimateWindow(this.m_Form.Handle, this.m_Duration, flags); } }
public BuildLibraryNotification(String libraryName) { InitializeComponent(); // WINDOWS 10 UPDATE HACK: Because Windows 10 update version 1803 causes unparented non-ShowInTaskbar windows to leak GDI and User handles ShowInTaskbar = Program.FunctionalTest; _libraryName = libraryName; LibraryNameLabel.Text = string.Format(Resources.BuildLibraryNotification_BuildLibraryNotification_Library__0__, _libraryName); var showParams = new FormAnimator.AnimationParams( FormAnimator.AnimationMethod.slide, FormAnimator.AnimationDirection.up, 0); var hideParams = new FormAnimator.AnimationParams( FormAnimator.AnimationMethod.blend, FormAnimator.AnimationDirection.up, 0); _animator = new FormAnimator(this, showParams, hideParams) { ShowParams = { Duration = ANIMATION_DURATION } }; // Not sure why this is necessary, but sometimes the form doesn't // appear without it. Opacity = 1; _thread = BackgroundEventThreads.CreateThreadForAction(Notify); _thread.Name = @"BuildLibraryNotification"; _thread.IsBackground = true; _windowCreatedEvent = new ManualResetEvent(false); HandleCreated += Notification_HandleCreated; _displayTimer = new Timer(); _displayTimer.Tick += OnDisplayTimerEvent; _displayTimer.Interval = DISPLAY_DURATION; }
private void buttonNMLCopyNormals_Click(object sender, EventArgs e) { try { if (listViewNmlMeshes.SelectedItems.Count < 1) { return; } List <DockContent> formAnimators; FormAnimator dstFormAnim = GetFormAnimatorFromParserName(out formAnimators); Gui.Scripting.RunScript(EditorVar + ".CopyNormals(id=" + (int)listViewNmlMeshes.SelectedItems[0].Tag + ", dstAnimatorEditor=" + dstFormAnim.EditorVar + ", minOrMax=" + radioButtonNMLMaxNormals.Checked + ", setOrGet=" + (sender == buttonNMLGetNormals) + ")"); Changed = true; LoadNml(); if (sender == buttonNMLGetNormals) { dstFormAnim.RecreateRenderObjects(); } } catch (Exception ex) { Utility.ReportException(ex); } }
/// <summary> /// Create new Notification /// </summary> /// <param name="title">title text</param> /// <param name="body">main body, as text or HTML</param> /// <param name="buttons">optional list of buttons</param> /// <param name="animation">optional animation overrides</param> public Notification(string title, string body, int hideInMs = 0, List <NotificationButton> buttons = null, NotificationAnimation animation = null) : base() { InitializeComponent(); if (animation == null) { animation = new NotificationAnimation(); } lifeTimer.Interval = (hideInMs > 0 ? hideInMs : int.MaxValue); // set the title labelTitle.Text = title; // show or hide the buttons _buttons = buttons; if (_buttons == null || _buttons.Count == 0) { buttonPanel.Visible = false; } else { buttonPanel.Visible = true; this.Height += buttonPanel.Height; this.labelBody.Height -= buttonPanel.Height; this.htmlBody.Height -= buttonPanel.Height; if (_buttons.Count >= 1) { button1.Text = _buttons[0].Text; button1.Tag = _buttons[0]; } if (_buttons.Count >= 2) { button2.Text = _buttons[1].Text; button2.Tag = _buttons[1]; button2.Visible = true; } if (_buttons.Count >= 3) { button3.Text = _buttons[2].Text; button3.Tag = _buttons[2]; button3.Visible = true; } } // set the body text or html if (body.IndexOf("<") == -1) { labelBody.Text = body; labelBody.Visible = true; } else { // inject browser TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel browser = new TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel(); browser.Dock = DockStyle.Fill; browser.Location = new Point(0, 0); browser.Size = new Size(htmlBody.Width, htmlBody.Height); htmlBody.Controls.Add(browser); browser.Text = "<!doctype html><html><head><meta charset=\"UTF-8\"><style>html,body{width:100%;height:100%;margin:0;padding:0;}body{margin:0 5px;font-size:14px;border:1px;}h1{font-size:16px;font-weight:normal;margin:0;padding:0 0 4px 0;}</style></head><body>" + body + "</body></html>"; browser.AutoScroll = false; browser.IsSelectionEnabled = false; browser.Click += Notification_Click; htmlBody.Visible = true; } if (OnNotificationClicked != null) { this.labelBody.Cursor = Cursors.Hand; this.htmlBody.Cursor = Cursors.Hand; } _animator = new FormAnimator(this, animation.Method, animation.Direction, 500); //Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 5, 5)); }
private void buttonNmlCompute_Click(object sender, EventArgs e) { if (listViewNmlMeshes.SelectedItems.Count == 0) { return; } buttonNmlCompute.Enabled = false; try { List <DockContent> formAnimators; FormAnimator dstFormAnim = GetFormAnimatorFromParserName(out formAnimators); StringBuilder meshIds = new StringBuilder(20); for (int i = 0; i < listViewNmlMeshes.SelectedItems.Count; i++) { meshIds.Append((int)listViewNmlMeshes.SelectedItems[i].Tag).Append(", "); } meshIds.Insert(0, "{ "); meshIds.Length -= 2; meshIds.Append(" }"); StringBuilder adjAnimEditorMeshIdPairs = new StringBuilder(200); foreach (var form in formAnimators) { FormAnimator formAnim = (FormAnimator)form; if (formAnim.listViewMesh.SelectedItems.Count > 0) { for (int i = 0; i < formAnim.listViewMesh.SelectedItems.Count; i++) { adjAnimEditorMeshIdPairs.Append(formAnim.EditorVar).Append(", ").Append((int)formAnim.listViewMesh.SelectedItems[i].Tag).Append(", "); } } } if (adjAnimEditorMeshIdPairs.Length > 0) { adjAnimEditorMeshIdPairs.Insert(0, "{ "); adjAnimEditorMeshIdPairs.Length -= 2; adjAnimEditorMeshIdPairs.Append(" }"); } else { adjAnimEditorMeshIdPairs.Append("null"); } if (comboBoxSourceNmlMonoBehaviour.SelectedIndex <= 0 || comboBoxSourceAnimator.SelectedIndex <= 0) { Gui.Scripting.RunScript(EditorVar + ".ComputeMinMaxNormals(nmlMeshIds=" + meshIds + ", dstAnimatorEditor=" + dstFormAnim.EditorVar + ", adjacentAnimatorEditorMeshIdPairs=" + adjAnimEditorMeshIdPairs + ", adjacentSquaredDistance=" + numericUpDownNmlAdjacentDistanceSquared.Value + ", worldCoordinates=" + checkBoxNmlWorldCoordinates.Checked + ")"); } else { Tuple <string, string> itemNml = (Tuple <string, string>)comboBoxSourceNmlMonoBehaviour.SelectedItem; Tuple <string, int> itemMesh = (Tuple <string, int>)comboBoxSourceMesh.SelectedItem; Tuple <string, string> itemAnim = (Tuple <string, string>)comboBoxSourceAnimator.SelectedItem; Gui.Scripting.RunScript(EditorVar + ".ComputeMinMaxNormals(nmlMeshIds=" + meshIds + ", dstAnimatorEditor=" + dstFormAnim.EditorVar + ", srcNmlParser=" + itemNml.Item2 + ", srcNmlMeshId=" + itemMesh.Item2 + ", srcAnimatorEditor=" + itemAnim.Item2 + ", adjacentAnimatorEditorMeshIdPairs=" + adjAnimEditorMeshIdPairs + ", adjacentSquaredDistance=" + numericUpDownNmlAdjacentDistanceSquared.Value + ", worldCoordinates=" + checkBoxNmlWorldCoordinates.Checked + ")"); } listViewNmlMeshes.Focus(); LoadNml(); Changed = Changed; foreach (var form in formAnimators) { FormAnimator formAnim = (FormAnimator)form; if (formAnim.listViewMesh.SelectedItems.Count > 0 && formAnim.Changed) { formAnim.Changed = formAnim.Changed; formAnim.RecreateRenderObjects(); } } } catch (Exception ex) { Utility.ReportException(ex); } finally { buttonNmlCompute.Enabled = true; } }
/// <summary> /// Create new Notification /// </summary> /// <param name="title">title text</param> /// <param name="body">main body, as text or HTML</param> /// <param name="buttons">optional list of buttons</param> /// <param name="animation">optional animation overrides</param> public Notification(string title, string body, int hideInMs = 0, List<NotificationButton> buttons = null, NotificationAnimation animation = null) : base() { InitializeComponent(); if (animation == null) { animation = new NotificationAnimation(); } lifeTimer.Interval = (hideInMs > 0 ? hideInMs : int.MaxValue); // set the title labelTitle.Text = title; // show or hide the buttons _buttons = buttons; if (_buttons == null || _buttons.Count == 0) { buttonPanel.Visible = false; } else { buttonPanel.Visible = true; this.Height += buttonPanel.Height; this.labelBody.Height -= buttonPanel.Height; this.htmlBody.Height -= buttonPanel.Height; if (_buttons.Count >= 1) { button1.Text = _buttons[0].Text; button1.Tag = _buttons[0]; } if (_buttons.Count >= 2) { button2.Text = _buttons[1].Text; button2.Tag = _buttons[1]; button2.Visible = true; } if (_buttons.Count >= 3) { button3.Text = _buttons[2].Text; button3.Tag = _buttons[2]; button3.Visible = true; } } // set the body text or html if (body.IndexOf("<") == -1) { labelBody.Text = body; labelBody.Visible = true; } else { // inject browser TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel browser = new TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel(); browser.Dock = DockStyle.Fill; browser.Location = new Point(0, 0); browser.Size = new Size(htmlBody.Width, htmlBody.Height); htmlBody.Controls.Add(browser); browser.Text = "<!doctype html><html><head><meta charset=\"UTF-8\"><style>html,body{width:100%;height:100%;margin:0;padding:0;}body{margin:0 5px;font-size:14px;border:1px;}h1{font-size:16px;font-weight:normal;margin:0;padding:0 0 4px 0;}</style></head><body>" + body + "</body></html>"; browser.AutoScroll = false; browser.IsSelectionEnabled = false; browser.Click += Notification_Click; htmlBody.Visible = true; } if (OnNotificationClicked != null) { this.labelBody.Cursor = Cursors.Hand; this.htmlBody.Cursor = Cursors.Hand; } _animator = new FormAnimator(this, animation.Method, animation.Direction, 500); //Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 5, 5)); }