This repository has been archived on 2024-08-06. You can view files and clone it, but cannot push or open issues or pull requests.
linear-app-launcher/MainForm.cs

123 lines
3.2 KiB
C#
Raw Normal View History

2020-03-28 02:54:08 +00:00
using AppLauncher.Windows.Forms;
using System;
2020-03-27 23:16:34 +00:00
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
2020-03-30 10:48:24 +00:00
using System.Diagnostics;
2020-03-27 23:16:34 +00:00
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppLauncher
{
2020-03-28 02:54:08 +00:00
public partial class MainForm : AForm
2020-03-27 23:16:34 +00:00
{
2020-03-28 02:54:08 +00:00
public MainForm() : base()
2020-03-27 23:16:34 +00:00
{
InitializeComponent();
}
2020-04-05 00:32:49 +00:00
private async void button1_Click(object sender, EventArgs e)
2020-03-29 14:28:38 +00:00
{
if (this.Width > 40)
{
2020-04-05 00:32:49 +00:00
await collapseWindow(40, 6);
2020-03-29 14:28:38 +00:00
}
else
{
2020-04-05 00:32:49 +00:00
await expandWindow(800, 8);
2020-03-29 14:28:38 +00:00
}
}
2020-03-30 10:48:24 +00:00
private void button2_Click(object sender, EventArgs e)
{
2020-04-05 00:32:49 +00:00
//ProcessStartInfo process = new ProcessStartInfo();
//process.FileName = @"C:\B\Portable Files (pure)\Build and Deploy Utility\v0.2.0.046 alpha\badutil.exe";
//process.Arguments = "";
//process.WindowStyle = ProcessWindowStyle.Normal;
//process.Verb = "runas";
//Process.Start(process);
//richTextBox1.Text += tilePanelContainer1.GridSize.ToString() + Environment.NewLine;
tilePanelContainer1.Controls.Add(tilePanel1);
tilePanel1.Location = new Point(0, 0);
tilePanelContainer1.Controls.Add(tilePanel2);
tilePanel2.Location = new Point(0, 0);
2020-03-30 10:48:24 +00:00
}
2020-04-05 00:32:49 +00:00
protected async Task collapseWindow(int width, int increment = 8)
{
await Task.Run(() =>
{
while (this.Width > width)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.Width -= increment;
}));
}
else
{
this.Width -= increment;
}
Application.DoEvents();
}
});
}
2020-03-27 23:16:34 +00:00
2020-04-05 00:32:49 +00:00
protected async Task expandWindow(int width, int increment = 8)
{
await Task.Run(() =>
{
while (this.Width < width)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.Width += increment;
this.Invalidate();
}));
}
else
{
this.Width += increment;
this.Invalidate();
}
2020-03-27 23:16:34 +00:00
2020-04-05 00:32:49 +00:00
Application.DoEvents();
}
});
}
2020-03-27 23:16:34 +00:00
//private void Form1_MouseDown(object sender, MouseEventArgs e)
//{
// const int WM_NCLBUTTONDOWN = 0xA1;
// const int HT_CAPTION = 0x2;
// this.Capture = false;
// Message msg = Message.Create(this.Handle, WM_NCLBUTTONDOWN, (IntPtr)HT_CAPTION, IntPtr.Zero);
// WndProc(ref msg);
//}
}
}