Add project
This commit is contained in:
227
.gitignore
vendored
Normal file
227
.gitignore
vendored
Normal file
@ -0,0 +1,227 @@
|
||||
# The following command works for downloading when using Git for Windows:
|
||||
# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||
#
|
||||
# Download this file using PowerShell v3 under Windows with the following comand:
|
||||
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
|
||||
#
|
||||
# or wget:
|
||||
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
# build folder is nowadays used for build scripts and should not be ignored
|
||||
#build/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
modulesbin/
|
||||
tempbin/
|
||||
|
||||
# EPiServer Site file (VPP)
|
||||
AppData/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# vim
|
||||
*.txt~
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Temp files when opening LibreOffice on ubuntu
|
||||
.~lock.*
|
||||
|
||||
# svn
|
||||
.svn
|
||||
|
||||
# CVS - Source Control
|
||||
**/CVS/
|
||||
|
||||
# Remainings from resolving conflicts in Source Control
|
||||
*.orig
|
||||
|
||||
# SQL Server files
|
||||
**/App_Data/*.mdf
|
||||
**/App_Data/*.ldf
|
||||
**/App_Data/*.sdf
|
||||
|
||||
|
||||
#LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
_Pvt_Extensions/
|
||||
ModelManifest.xml
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# OS generated files #
|
||||
Icon?
|
||||
|
||||
# Mac desktop service store files
|
||||
.DS_Store
|
||||
|
||||
# SASS Compiler cache
|
||||
.sass-cache
|
||||
|
||||
# Visual Studio 2014 CTP
|
||||
**/*.sln.ide
|
||||
|
||||
# Visual Studio temp something
|
||||
.vs/
|
||||
|
||||
# dotnet stuff
|
||||
project.lock.json
|
||||
|
||||
# VS 2015+
|
||||
*.vc.vc.opendb
|
||||
*.vc.db
|
||||
|
||||
# Rider
|
||||
.idea/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
|
||||
# Output folder used by Webpack or other FE stuff
|
||||
**/node_modules/*
|
||||
**/wwwroot/*
|
||||
|
||||
# SpecFlow specific
|
||||
*.feature.cs
|
||||
*.feature.xlsx.*
|
||||
*.Specs_*.html
|
||||
|
||||
# UWP Projects
|
||||
AppPackages/
|
||||
|
||||
#####
|
||||
# End of core ignore list, below put you custom 'per project' settings (patterns or path)
|
||||
#####
|
||||
|
227
src/.gitignore
vendored
Normal file
227
src/.gitignore
vendored
Normal file
@ -0,0 +1,227 @@
|
||||
# The following command works for downloading when using Git for Windows:
|
||||
# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||
#
|
||||
# Download this file using PowerShell v3 under Windows with the following comand:
|
||||
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
|
||||
#
|
||||
# or wget:
|
||||
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
# build folder is nowadays used for build scripts and should not be ignored
|
||||
#build/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
modulesbin/
|
||||
tempbin/
|
||||
|
||||
# EPiServer Site file (VPP)
|
||||
AppData/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# vim
|
||||
*.txt~
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Temp files when opening LibreOffice on ubuntu
|
||||
.~lock.*
|
||||
|
||||
# svn
|
||||
.svn
|
||||
|
||||
# CVS - Source Control
|
||||
**/CVS/
|
||||
|
||||
# Remainings from resolving conflicts in Source Control
|
||||
*.orig
|
||||
|
||||
# SQL Server files
|
||||
**/App_Data/*.mdf
|
||||
**/App_Data/*.ldf
|
||||
**/App_Data/*.sdf
|
||||
|
||||
|
||||
#LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
_Pvt_Extensions/
|
||||
ModelManifest.xml
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# OS generated files #
|
||||
Icon?
|
||||
|
||||
# Mac desktop service store files
|
||||
.DS_Store
|
||||
|
||||
# SASS Compiler cache
|
||||
.sass-cache
|
||||
|
||||
# Visual Studio 2014 CTP
|
||||
**/*.sln.ide
|
||||
|
||||
# Visual Studio temp something
|
||||
.vs/
|
||||
|
||||
# dotnet stuff
|
||||
project.lock.json
|
||||
|
||||
# VS 2015+
|
||||
*.vc.vc.opendb
|
||||
*.vc.db
|
||||
|
||||
# Rider
|
||||
.idea/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
|
||||
# Output folder used by Webpack or other FE stuff
|
||||
**/node_modules/*
|
||||
**/wwwroot/*
|
||||
|
||||
# SpecFlow specific
|
||||
*.feature.cs
|
||||
*.feature.xlsx.*
|
||||
*.Specs_*.html
|
||||
|
||||
# UWP Projects
|
||||
AppPackages/
|
||||
|
||||
#####
|
||||
# End of core ignore list, below put you custom 'per project' settings (patterns or path)
|
||||
#####
|
||||
|
6
src/App.config
Executable file
6
src/App.config
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
139
src/Form1.Designer.cs
generated
Executable file
139
src/Form1.Designer.cs
generated
Executable file
@ -0,0 +1,139 @@
|
||||
namespace WidgetEmbed
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.SaveEmbedsCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.SaveButton = new System.Windows.Forms.Button();
|
||||
this.BoundsDetectionCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.CheckBoundsButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.BackColor = System.Drawing.SystemColors.Menu;
|
||||
this.textBox1.Location = new System.Drawing.Point(197, 112);
|
||||
this.textBox1.Multiline = true;
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(362, 143);
|
||||
this.textBox1.TabIndex = 1;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(591, 166);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(84, 44);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Create Embed";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(565, 112);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(129, 21);
|
||||
this.comboBox1.TabIndex = 3;
|
||||
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
|
||||
//
|
||||
// SaveEmbedsCheckbox
|
||||
//
|
||||
this.SaveEmbedsCheckbox.AutoSize = true;
|
||||
this.SaveEmbedsCheckbox.Location = new System.Drawing.Point(1, 23);
|
||||
this.SaveEmbedsCheckbox.Name = "SaveEmbedsCheckbox";
|
||||
this.SaveEmbedsCheckbox.Size = new System.Drawing.Size(138, 17);
|
||||
this.SaveEmbedsCheckbox.TabIndex = 4;
|
||||
this.SaveEmbedsCheckbox.Text = "Save Embeds On Close";
|
||||
this.SaveEmbedsCheckbox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
this.SaveButton.Location = new System.Drawing.Point(708, 1);
|
||||
this.SaveButton.Name = "SaveButton";
|
||||
this.SaveButton.Size = new System.Drawing.Size(91, 26);
|
||||
this.SaveButton.TabIndex = 5;
|
||||
this.SaveButton.Text = "Save Now";
|
||||
this.SaveButton.UseVisualStyleBackColor = true;
|
||||
this.SaveButton.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// BoundsDetectionCheckbox
|
||||
//
|
||||
this.BoundsDetectionCheckbox.AutoSize = true;
|
||||
this.BoundsDetectionCheckbox.Location = new System.Drawing.Point(1, 1);
|
||||
this.BoundsDetectionCheckbox.Name = "BoundsDetectionCheckbox";
|
||||
this.BoundsDetectionCheckbox.Size = new System.Drawing.Size(138, 17);
|
||||
this.BoundsDetectionCheckbox.TabIndex = 6;
|
||||
this.BoundsDetectionCheckbox.Text = "Check Bounds On Start";
|
||||
this.BoundsDetectionCheckbox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CheckBoundsButton
|
||||
//
|
||||
this.CheckBoundsButton.Location = new System.Drawing.Point(708, 33);
|
||||
this.CheckBoundsButton.Name = "CheckBoundsButton";
|
||||
this.CheckBoundsButton.Size = new System.Drawing.Size(91, 26);
|
||||
this.CheckBoundsButton.TabIndex = 7;
|
||||
this.CheckBoundsButton.Text = "Check Bounds";
|
||||
this.CheckBoundsButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.CheckBoundsButton);
|
||||
this.Controls.Add(this.BoundsDetectionCheckbox);
|
||||
this.Controls.Add(this.SaveButton);
|
||||
this.Controls.Add(this.SaveEmbedsCheckbox);
|
||||
this.Controls.Add(this.comboBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Name = "Form1";
|
||||
this.Text = "WidgetEmbed";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.CheckBox SaveEmbedsCheckbox;
|
||||
private System.Windows.Forms.Button SaveButton;
|
||||
private System.Windows.Forms.CheckBox BoundsDetectionCheckbox;
|
||||
private System.Windows.Forms.Button CheckBoundsButton;
|
||||
}
|
||||
}
|
||||
|
497
src/Form1.cs
Executable file
497
src/Form1.cs
Executable file
@ -0,0 +1,497 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace WidgetEmbed
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static List<Form2> WidgetWindows = new List<Form2>();
|
||||
public static List<Widget> Widgets = new List<Widget>();
|
||||
public static bool BeginningShutdown = false;
|
||||
|
||||
string directoryLocation = Environment.ExpandEnvironmentVariables(@"%Public%\Documents\WidgetEmbed\");
|
||||
string widgetFileName = "SavedWidgets.wgt";
|
||||
|
||||
bool widgetsVisible = true;
|
||||
bool isAnimatingWidgets;
|
||||
bool isAnimatingForm;
|
||||
bool formVisible = true;
|
||||
|
||||
|
||||
public ContextMenuStrip contextMenu1 = new ContextMenuStrip();
|
||||
public ToolStripMenuItem MenuItem1 = new ToolStripMenuItem("HideWidgets");
|
||||
public ToolStripMenuItem MenuItem2 = new ToolStripMenuItem("HideAddWidgetsMenu");
|
||||
public ToolStripMenuItem MenuItem3 = new ToolStripMenuItem("CloseApplication");
|
||||
NotifyIcon ni = new NotifyIcon();
|
||||
|
||||
public static bool ScreenBoundsDetection = true;
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == WM_QUERYENDSESSION || m.Msg == WM_ENDSESSION)
|
||||
{
|
||||
BeginningShutdown = true;
|
||||
ShuttingDown();
|
||||
}
|
||||
base.WndProc(ref m);
|
||||
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
SystemEvents.SessionEnding += (s, eargs) =>
|
||||
{
|
||||
ShuttingDown();
|
||||
eargs.Cancel = true;
|
||||
};
|
||||
|
||||
InputBox.Instance = new InputBox();
|
||||
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
|
||||
this.Visible = false;
|
||||
this.Opacity = 0;
|
||||
|
||||
this.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - this.Size.Width) / 2, (Screen.PrimaryScreen.WorkingArea.Height - this.Size.Height) / 2);
|
||||
|
||||
|
||||
button1.Enabled = false;
|
||||
|
||||
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBox1.Items.Add("Website URL");
|
||||
comboBox1.Items.Add("HTML Embed Widget");
|
||||
|
||||
ni.Visible = true;
|
||||
ni.Icon = SystemIcons.Application;
|
||||
ni.Text = "WidgetEmbed (Visible)";
|
||||
ni.ContextMenuStrip = contextMenu1;
|
||||
|
||||
contextMenu1.Items.Add(MenuItem1);
|
||||
contextMenu1.Items.Add(MenuItem2);
|
||||
contextMenu1.Items.Add(MenuItem3);
|
||||
|
||||
MenuItem1.Text = "Hide Widgets";
|
||||
MenuItem2.Text = "Hide Add Widgets Menu";
|
||||
MenuItem3.Text = "Exit Application";
|
||||
|
||||
MenuItem1.Image = SystemIcons.Application.ToBitmap();
|
||||
MenuItem2.Image = SystemIcons.Question.ToBitmap();
|
||||
MenuItem3.Image = SystemIcons.Error.ToBitmap();
|
||||
|
||||
MenuItem1.Click += (s, eargs) =>
|
||||
{
|
||||
ChangeWidgetVisibility();
|
||||
};
|
||||
|
||||
MenuItem2.Click += (s, eargs) =>
|
||||
{
|
||||
if (isAnimatingForm)
|
||||
return;
|
||||
|
||||
formVisible = (this.Opacity == 1 ? true : false);
|
||||
|
||||
MenuItem2.Text = (formVisible ? "Show" : "Hide") + " Add Widgets Menu";
|
||||
|
||||
Fade(this, (formVisible ? "FadeOut" : "FadeIn"), 10);
|
||||
};
|
||||
|
||||
MenuItem3.Click += (s, eargs) =>
|
||||
{
|
||||
TryClose();
|
||||
};
|
||||
|
||||
this.FormClosing += (s, fcea) =>
|
||||
{
|
||||
if (!BeginningShutdown)
|
||||
{
|
||||
fcea.Cancel = TryClose();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShuttingDown();
|
||||
fcea.Cancel = true;
|
||||
}
|
||||
};
|
||||
|
||||
ni.MouseDoubleClick += (s, mea) =>
|
||||
{
|
||||
ChangeWidgetVisibility();
|
||||
};
|
||||
|
||||
CheckBoundsButton.Click += (s, eargs) =>
|
||||
{
|
||||
CheckBounds();
|
||||
};
|
||||
|
||||
|
||||
//Serialiation
|
||||
if (!Directory.Exists(directoryLocation))
|
||||
{
|
||||
Directory.CreateDirectory(directoryLocation);
|
||||
}
|
||||
|
||||
if (!File.Exists(directoryLocation + widgetFileName))
|
||||
{
|
||||
File.Create(directoryLocation + widgetFileName).Close();
|
||||
}
|
||||
else if (new FileInfo(directoryLocation + widgetFileName).Length == 0)
|
||||
{
|
||||
//file exists, but is empty!
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadWidgets();
|
||||
}
|
||||
|
||||
this.Visible = true;
|
||||
this.Opacity = 1;
|
||||
}
|
||||
|
||||
const int WM_QUERYENDSESSION = 0x0011;
|
||||
const int WM_ENDSESSION = 0x0016;
|
||||
|
||||
|
||||
public void ShuttingDown()
|
||||
{
|
||||
if (SaveEmbedsCheckbox.Checked)
|
||||
{
|
||||
SaveWidgets();
|
||||
}
|
||||
|
||||
for (int i = 0; i < WidgetWindows.Count; i++)
|
||||
{
|
||||
WidgetWindows[i].Close();
|
||||
}
|
||||
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public bool TryClose()
|
||||
{
|
||||
|
||||
DialogResult dr = MessageBox.Show(new Form { TopMost = true }, "Are you sure you want to exit?", "Program Exiting Prompt", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
if (SaveEmbedsCheckbox.Checked)
|
||||
SaveWidgets();
|
||||
|
||||
|
||||
ni.Visible = false;
|
||||
ni.Icon = null;
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void CheckBounds()
|
||||
{
|
||||
for (int i = 0; i < WidgetWindows.Count; i++)
|
||||
{
|
||||
if (!IsOnScreen(WidgetWindows[i]))
|
||||
if (MessageBox.Show(new Form { TopMost = true }, "Widget: \"" + Widgets[i].WidgetTitle + "\" was not detected within the safe bounds area.\nWould you like to relocate it to the center of the main screen?", "Safe Bounds Detection", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
WidgetWindows[i].Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - WidgetWindows[i].Size.Width) / 2, (Screen.PrimaryScreen.WorkingArea.Height - WidgetWindows[i].Size.Height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show(new Form { TopMost = true }, "Bound Check Complete!", "Safe Bounds Detection", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
public void ChangeWidgetVisibility()
|
||||
{
|
||||
if (isAnimatingWidgets)
|
||||
return;
|
||||
|
||||
widgetsVisible = !widgetsVisible;
|
||||
|
||||
ni.Text = "WidgetEmbed " + (widgetsVisible ? "(Visible)" : "(Hidden)");
|
||||
MenuItem1.Text = (widgetsVisible ? "Hide" : "Show") + " Widgets";
|
||||
|
||||
if (widgetsVisible)
|
||||
{
|
||||
for (int i = 0; i < WidgetWindows.Count; i++)
|
||||
{
|
||||
Fade(WidgetWindows[i], "FadeIn", 10);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < WidgetWindows.Count; i++)
|
||||
{
|
||||
//WidgetWindows[i].Enabled = false;
|
||||
Fade(WidgetWindows[i], "FadeOut", 10);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SerializedWidgetData sd;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static bool IsOnScreen(Form form)
|
||||
{
|
||||
Screen[] screens = Screen.AllScreens;
|
||||
foreach (Screen screen in screens)
|
||||
{
|
||||
Rectangle formRectangle = new Rectangle(form.Left, form.Top, 60, 60);
|
||||
|
||||
if (screen.WorkingArea.Contains(formRectangle))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private async void Fade(Form o, string FadeType, int interval = 80)
|
||||
{
|
||||
bool AnimatingForm = (o == this);
|
||||
|
||||
if (AnimatingForm)
|
||||
isAnimatingForm = true;
|
||||
else
|
||||
isAnimatingWidgets = true;
|
||||
|
||||
if (FadeType == "FadeIn")
|
||||
{
|
||||
if (AnimatingForm)
|
||||
{
|
||||
|
||||
this.ShowInTaskbar = true;
|
||||
this.Visible = true;
|
||||
}
|
||||
|
||||
//Object is not fully invisible. Fade it in
|
||||
while (o.Opacity < 1.0)
|
||||
{
|
||||
await Task.Delay(interval);
|
||||
o.Opacity += 0.05;
|
||||
}
|
||||
o.Opacity = 1; //make fully visible
|
||||
|
||||
if (AnimatingForm)
|
||||
isAnimatingForm = false;
|
||||
else
|
||||
isAnimatingWidgets = false;
|
||||
}
|
||||
else if (FadeType == "FadeOut")
|
||||
{
|
||||
//Object is fully visible. Fade it out
|
||||
while (o.Opacity > 0.0)
|
||||
{
|
||||
await Task.Delay(interval);
|
||||
o.Opacity -= 0.05;
|
||||
}
|
||||
o.Opacity = 0; //make fully invisible
|
||||
|
||||
if (AnimatingForm)
|
||||
{
|
||||
isAnimatingForm = false;
|
||||
{
|
||||
this.ShowInTaskbar = false;
|
||||
this.Visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
isAnimatingWidgets = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async void SaveWidgets()
|
||||
{
|
||||
if (sd == null)
|
||||
sd = new SerializedWidgetData();
|
||||
|
||||
sd.SaveOnClose = SaveEmbedsCheckbox.Checked;
|
||||
sd.PrimaryScreenDetection = BoundsDetectionCheckbox.Checked;
|
||||
|
||||
if (isAnimatingForm)
|
||||
{
|
||||
double check1 = this.Opacity;
|
||||
await Task.Delay(1000);
|
||||
double check2 = this.Opacity;
|
||||
|
||||
sd.WidgetMenuShown = check1 < check2 ? true : false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sd.WidgetMenuShown = this.Opacity == 1 ? true : false;
|
||||
}
|
||||
|
||||
sd.Widgets = Widgets;
|
||||
|
||||
SerializeXml<SerializedWidgetData>(sd, directoryLocation + widgetFileName);
|
||||
}
|
||||
|
||||
public void LoadWidgets()
|
||||
{
|
||||
sd = DeserializeXml<SerializedWidgetData>(directoryLocation + widgetFileName);
|
||||
|
||||
if (sd == null)
|
||||
return;
|
||||
|
||||
SaveEmbedsCheckbox.Checked = sd.SaveOnClose;
|
||||
BoundsDetectionCheckbox.Checked = sd.PrimaryScreenDetection;
|
||||
|
||||
if (sd.WidgetMenuShown)
|
||||
{
|
||||
this.Visible = true;
|
||||
this.Opacity = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Opacity = 0;
|
||||
this.ShowInTaskbar = false;
|
||||
formVisible = false;
|
||||
MenuItem2.Text = "Show Add Widgets Menu";
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < sd.Widgets.Count; i++)
|
||||
{
|
||||
Form f2 = new Form2(sd.Widgets[i].WidgetWebData, sd.Widgets[i].WidgetLoadType, sd.Widgets[i].WidgetWindowSize, sd.Widgets[i].WidgetLocation, sd.Widgets[i].WidgetZoomScale, sd.Widgets[i].WidgetTitle);
|
||||
f2.Show();
|
||||
|
||||
SetWindowPos(f2.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
|
||||
}
|
||||
|
||||
if (BoundsDetectionCheckbox.Checked)
|
||||
{
|
||||
this.Shown += (s, eargs) =>
|
||||
{
|
||||
CheckBounds();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public T SerializeXml<T>(T objToSerialize, string outputFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
XmlSerializer s = new XmlSerializer(typeof(SerializedWidgetData));
|
||||
|
||||
using (TextWriter tw = new StreamWriter(outputFile))
|
||||
{
|
||||
s.Serialize(tw, objToSerialize);
|
||||
tw.Close();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(new Form { TopMost = true }, "Error while saving data!\nError:" + ex.Message, "Error Has Occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public T DeserializeXml<T>(string inputFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
XmlSerializer s = new XmlSerializer(typeof(T));
|
||||
T deserializedObject = default(T);
|
||||
|
||||
using (TextReader tr = new StreamReader(inputFile))
|
||||
{
|
||||
deserializedObject = (T)s.Deserialize(tr);
|
||||
tr.Close();
|
||||
}
|
||||
|
||||
return deserializedObject;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(new Form { TopMost = true }, "Save file corrupted!\nGenerating New File\nError:" + ex.Message, "Error Has Occured", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
return default(T);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Form2 f2 = new Form2(textBox1.Text, (Form2.LoadType)comboBox1.SelectedIndex);
|
||||
f2.Show();
|
||||
|
||||
SetWindowPos(f2.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
|
||||
|
||||
}
|
||||
|
||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBox1.SelectedIndex > -1)
|
||||
button1.Enabled = true;
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveWidgets();
|
||||
}
|
||||
|
||||
public static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
|
||||
public const UInt32 SWP_NOSIZE = 0x0001;
|
||||
public const UInt32 SWP_NOMOVE = 0x0002;
|
||||
public const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
|
||||
const int SW_MAXIMIZE = 3;
|
||||
const int SW_MINIMIZE = 6;
|
||||
const int SW_SHOW = 5;
|
||||
const int SW_HIDE = 0;
|
||||
const int SW_SHOWNORMAL = 1;
|
||||
const int SW_RESTORE = 9;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class SerializedWidgetData
|
||||
{
|
||||
public List<Widget> Widgets = new List<Widget>();
|
||||
public bool SaveOnClose;
|
||||
public bool WidgetMenuShown;
|
||||
public bool PrimaryScreenDetection;
|
||||
}
|
||||
}
|
120
src/Form1.resx
Executable file
120
src/Form1.resx
Executable file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
143
src/Form2.Designer.cs
generated
Executable file
143
src/Form2.Designer.cs
generated
Executable file
@ -0,0 +1,143 @@
|
||||
namespace WidgetEmbed
|
||||
{
|
||||
|
||||
partial class Form2
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.Exit = new System.Windows.Forms.Button();
|
||||
this.Reload = new System.Windows.Forms.Button();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.ZoomOut = new System.Windows.Forms.Button();
|
||||
this.ZoomIn = new System.Windows.Forms.Button();
|
||||
this.WindowTitle = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// Exit
|
||||
//
|
||||
this.Exit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Exit.ForeColor = System.Drawing.Color.White;
|
||||
this.Exit.Location = new System.Drawing.Point(780, 0);
|
||||
this.Exit.Name = "Exit";
|
||||
this.Exit.Size = new System.Drawing.Size(25, 25);
|
||||
this.Exit.TabIndex = 1;
|
||||
this.Exit.TabStop = false;
|
||||
this.Exit.Text = "X";
|
||||
this.Exit.UseVisualStyleBackColor = true;
|
||||
this.Exit.Click += new System.EventHandler(this.Exit_Click);
|
||||
//
|
||||
// Reload
|
||||
//
|
||||
this.Reload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Reload.ForeColor = System.Drawing.Color.White;
|
||||
this.Reload.Location = new System.Drawing.Point(756, 0);
|
||||
this.Reload.Name = "Reload";
|
||||
this.Reload.Size = new System.Drawing.Size(25, 25);
|
||||
this.Reload.TabIndex = 2;
|
||||
this.Reload.TabStop = false;
|
||||
this.Reload.Text = "↻";
|
||||
this.Reload.UseVisualStyleBackColor = true;
|
||||
this.Reload.Click += new System.EventHandler(this.Reload_Click);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.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.panel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
||||
this.panel1.Location = new System.Drawing.Point(12, 29);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(782, 473);
|
||||
this.panel1.TabIndex = 3;
|
||||
//
|
||||
// ZoomOut
|
||||
//
|
||||
this.ZoomOut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ZoomOut.ForeColor = System.Drawing.Color.White;
|
||||
this.ZoomOut.Location = new System.Drawing.Point(708, 0);
|
||||
this.ZoomOut.Name = "ZoomOut";
|
||||
this.ZoomOut.Size = new System.Drawing.Size(25, 25);
|
||||
this.ZoomOut.TabIndex = 5;
|
||||
this.ZoomOut.TabStop = false;
|
||||
this.ZoomOut.Text = "-";
|
||||
this.ZoomOut.UseVisualStyleBackColor = true;
|
||||
this.ZoomOut.Click += new System.EventHandler(this.ZoomOut_Click);
|
||||
//
|
||||
// ZoomIn
|
||||
//
|
||||
this.ZoomIn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ZoomIn.ForeColor = System.Drawing.Color.White;
|
||||
this.ZoomIn.Location = new System.Drawing.Point(732, 0);
|
||||
this.ZoomIn.Name = "ZoomIn";
|
||||
this.ZoomIn.Size = new System.Drawing.Size(25, 25);
|
||||
this.ZoomIn.TabIndex = 4;
|
||||
this.ZoomIn.TabStop = false;
|
||||
this.ZoomIn.Text = "+";
|
||||
this.ZoomIn.UseVisualStyleBackColor = true;
|
||||
this.ZoomIn.Click += new System.EventHandler(this.ZoomIn_Click);
|
||||
//
|
||||
// WindowTitle
|
||||
//
|
||||
this.WindowTitle.AutoSize = true;
|
||||
this.WindowTitle.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.WindowTitle.ForeColor = System.Drawing.Color.White;
|
||||
this.WindowTitle.Location = new System.Drawing.Point(12, 6);
|
||||
this.WindowTitle.Name = "WindowTitle";
|
||||
this.WindowTitle.Size = new System.Drawing.Size(94, 19);
|
||||
this.WindowTitle.TabIndex = 6;
|
||||
this.WindowTitle.Text = "Default title";
|
||||
this.WindowTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// Form2
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ControlText;
|
||||
this.ClientSize = new System.Drawing.Size(806, 514);
|
||||
this.Controls.Add(this.ZoomOut);
|
||||
this.Controls.Add(this.ZoomIn);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.Reload);
|
||||
this.Controls.Add(this.Exit);
|
||||
this.Controls.Add(this.WindowTitle);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "Form2";
|
||||
this.Load += new System.EventHandler(this.Form2_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Button Exit;
|
||||
private System.Windows.Forms.Button Reload;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Button ZoomOut;
|
||||
private System.Windows.Forms.Button ZoomIn;
|
||||
private System.Windows.Forms.Label WindowTitle;
|
||||
}
|
||||
}
|
842
src/Form2.cs
Executable file
842
src/Form2.cs
Executable file
@ -0,0 +1,842 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using CefSharp.Handler;
|
||||
using CefSharp.WinForms;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace WidgetEmbed
|
||||
{
|
||||
public partial class Form2 : Form
|
||||
{
|
||||
ReSize resize = new ReSize();
|
||||
|
||||
//public static Form2 f2Instance;
|
||||
|
||||
public ChromiumWebBrowser browser;
|
||||
|
||||
string defaultTitle = "Title (Middle Click)";
|
||||
public Form2(string websiteData, LoadType loadType)
|
||||
{
|
||||
//f2Instance = this;
|
||||
|
||||
widget.WidgetWebData = websiteData;
|
||||
widget.WidgetLoadType = loadType;
|
||||
|
||||
InitializeComponent();
|
||||
//this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
InitBrowser();
|
||||
//CefSharpSettings.SubprocessExitIfParentProcessClosed = true; //look into this
|
||||
|
||||
this.Load += (s, eargs) =>
|
||||
{
|
||||
widget.WidgetLocation = new Point((Screen.PrimaryScreen.WorkingArea.Width - this.Size.Width) / 2, (Screen.PrimaryScreen.WorkingArea.Height - this.Size.Height) / 2);
|
||||
|
||||
SetWidgetTitle(defaultTitle);
|
||||
};
|
||||
|
||||
|
||||
//this.HandleCreated += (s, eargs) => { widget.Title = defaultTitle; };
|
||||
|
||||
|
||||
|
||||
|
||||
//this.FormBorderStyle = FormBorderStyle.None; // no borders
|
||||
//this.DoubleBuffered = true;
|
||||
//this.SetStyle(ControlStyles.ResizeRedraw, true); // this is to avoid visual artifacts
|
||||
}
|
||||
|
||||
public Form2(string websiteData, LoadType loadType, Size widgetSize, Point widgetLocation, double zoomScale, string widgetTitle)
|
||||
{
|
||||
//f2Instance = this;
|
||||
|
||||
widget.WidgetWebData = websiteData;
|
||||
widget.WidgetLoadType = loadType;
|
||||
widget.WidgetWindowSize = widgetSize;
|
||||
widget.WidgetLocation = widgetLocation;
|
||||
widget.WidgetZoomScale = zoomScale;
|
||||
|
||||
InitializeComponent();
|
||||
InitBrowser();
|
||||
|
||||
SetWidgetTitle(widgetTitle);
|
||||
|
||||
//this.HandleCreated += (s, eargs) =>
|
||||
//{
|
||||
|
||||
// if (!(widgetTitle.Length == 0))
|
||||
// widget.Title = widgetTitle;
|
||||
// else
|
||||
// widget.Title = defaultTitle;
|
||||
//};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public enum LoadType
|
||||
{
|
||||
WebsiteURL,
|
||||
HTMLEmbed
|
||||
}
|
||||
|
||||
|
||||
public static bool cefInit = false;
|
||||
public static bool ignoreLinkLoadingStateChanged;
|
||||
|
||||
public Widget widget = new Widget();
|
||||
|
||||
bool waitingToSetZoom = true;
|
||||
|
||||
public void InitBrowser()
|
||||
{
|
||||
if (!cefInit)
|
||||
{
|
||||
Cef.Initialize(new CefSettings());
|
||||
cefInit = true;
|
||||
}
|
||||
|
||||
browser = new ChromiumWebBrowser();
|
||||
browser.RequestHandler = new BrowserRequestHandler();
|
||||
browser.LifeSpanHandler = new BrowserLifeSpanHandler();
|
||||
|
||||
|
||||
browser.IsBrowserInitializedChanged += (s, e) =>
|
||||
{
|
||||
if (!browser.IsBrowserInitialized)
|
||||
return;
|
||||
|
||||
|
||||
if (widget.WidgetLoadType == LoadType.HTMLEmbed)
|
||||
browser.LoadHtml(widget.WidgetWebData, false);
|
||||
else if (widget.WidgetLoadType == LoadType.WebsiteURL)
|
||||
browser.Load(widget.WidgetWebData);
|
||||
|
||||
//this.WindowState = FormWindowState.Normal;
|
||||
//this.StartPosition = FormStartPosition.Manual;
|
||||
//if (!(widget.WidgetLocation == default)) //(interferes at 0,0
|
||||
|
||||
//if (Form1.ScreenBoundsDetection)
|
||||
//{
|
||||
// if (!((widget.WidgetLocation.X < 0 || widget.WidgetLocation.Y < 0) /*|| (widget.WidgetLocation.X > Form1.PrimaryScreen.Bounds.X - 25 || widget.WidgetLocation.Y > Form1.PrimaryScreen.Bounds.Y - 25)*/))
|
||||
// this.Invoke(new Action(() => this.Location = widget.WidgetLocation));
|
||||
// else
|
||||
// {
|
||||
// widget.WidgetLocation.X = widget.WidgetLocation.X < 0 ? 0 : widget.WidgetLocation.X;
|
||||
// widget.WidgetLocation.Y = widget.WidgetLocation.Y < 0 ? 0 : widget.WidgetLocation.Y;
|
||||
// this.Invoke(new Action(() => this.Location = widget.WidgetLocation));
|
||||
// }
|
||||
//}
|
||||
|
||||
this.Invoke(new Action(() => this.Location = widget.WidgetLocation));
|
||||
|
||||
if (!(widget.WidgetWindowSize == default))
|
||||
this.Invoke(new Action(() => this.Size = widget.WidgetWindowSize));
|
||||
|
||||
|
||||
this.Move += (sender, eargs) =>
|
||||
{
|
||||
//MessageBox.Show("LOCATION CHANGED");
|
||||
widget.WidgetLocation = this.Location;
|
||||
};
|
||||
|
||||
this.SizeChanged += (sender, eargs) =>
|
||||
{
|
||||
//MessageBox.Show("SIZE CHANGED");
|
||||
widget.WidgetWindowSize = this.Size;
|
||||
};
|
||||
|
||||
if (!(widget.WidgetZoomScale == 0))
|
||||
browser.LoadingStateChanged += (sender, eargs) =>
|
||||
{
|
||||
//MessageBox.Show("IS LOADED");
|
||||
if (!eargs.IsLoading)
|
||||
if (waitingToSetZoom)
|
||||
{
|
||||
browser.SetZoomLevel(widget.WidgetZoomScale);
|
||||
waitingToSetZoom = false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#region garbage
|
||||
//browser.Load(Embed);
|
||||
//browser.LoadingStateChanged += async (s, e) =>
|
||||
//{
|
||||
// //MessageBox.Show("Loading State Changed is current disabled for development purposes. (by dev)");
|
||||
// //MessageBox.Show("MAINFRAME URL: " + e.Browser.MainFrame.Url);
|
||||
|
||||
|
||||
// //e.Browser.StopLoad
|
||||
|
||||
// if (!e.IsLoading)
|
||||
// {
|
||||
// if (ignoreLinkLoadingStateChanged)
|
||||
// {
|
||||
// ignoreLinkLoadingStateChanged = false;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// string script = "(function() { var body = document.body, html = document.documentElement; return Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); })();";
|
||||
// await Task.Delay(5000);
|
||||
|
||||
// var taskResult = browser.EvaluateScriptAsync(script);
|
||||
|
||||
|
||||
// //Task t = new Task(() => browser.EvaluateScriptAsync(script));
|
||||
// //t.ContinueWith((task) =>
|
||||
// //{
|
||||
// // //MessageBox.Show("asdf");
|
||||
// // if (!task.IsFaulted)
|
||||
// // {
|
||||
// // var response = task as Task<JavascriptResponse>;
|
||||
// // var result = response.Result;
|
||||
|
||||
// // if (result.Success && response.Result != null)
|
||||
// // {
|
||||
// // taskResult = response.Result.ToString();
|
||||
// // }
|
||||
// // }
|
||||
// //});
|
||||
// //var height = t as Task<JavascriptResponse>;
|
||||
// //MessageBox.Show(height.Result.Result.ToString());
|
||||
// MessageBox.Show((dynamic)taskResult.Result.Message); //finish this tomorrow. trying to get height so then i can get width and make the sizes be predefined! (use:https://stackoverflow.com/questions/60435891/how-to-get-html-document-height-using-cefsharp)
|
||||
// }
|
||||
//};
|
||||
|
||||
//browser.Click += (s, e) =>
|
||||
//{
|
||||
|
||||
//};
|
||||
|
||||
#endregion
|
||||
|
||||
this.panel1.Controls.Add(browser);
|
||||
browser.Dock = DockStyle.Fill;
|
||||
|
||||
this.ShowInTaskbar = false;
|
||||
//browser.Dock = DockStyle.Fill;
|
||||
}
|
||||
|
||||
public async void UpdateTitle()
|
||||
{
|
||||
string Title = await InputBox.Instance.Show("Enter new widget title:", "Rename Widget", widget.WidgetTitle == defaultTitle ? "" : widget.WidgetTitle, 32); //Interaction.InputBox("Enter new widget title:\n(16 characters max)", "Rename Widget");
|
||||
|
||||
if (Title == widget.WidgetTitle)
|
||||
return;
|
||||
|
||||
if (Title.Length == 0)
|
||||
MessageBox.Show(new Form { TopMost = true }, "Title rename has been cancelled", "Rename Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
//else if (Title.Length > 32)
|
||||
// MessageBox.Show(new Form { TopMost = true }, "Title is too long!", "Title Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
else
|
||||
{
|
||||
SetWidgetTitle(Title);
|
||||
|
||||
MessageBox.Show(new Form { TopMost = true }, "Title has been renamed to: \"" + Title + "\"", "Rename Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//UpdateTitle();
|
||||
}
|
||||
|
||||
public void SetWidgetTitle(string Title)
|
||||
{
|
||||
widget.WidgetTitle = Title;
|
||||
WindowTitle.Text = Title;
|
||||
}
|
||||
|
||||
|
||||
#region WndProc stuff
|
||||
private const int cGrip = 16; // Grip size
|
||||
private const int cCaption = 32; // Caption bar height;
|
||||
private const int WM_NCLBUTTONDBLCLK = 0x00A3; //double click on a title bar a.k.a. non-client area of the form
|
||||
|
||||
int Mx;
|
||||
int My;
|
||||
int Sw;
|
||||
int Sh;
|
||||
|
||||
bool mov;
|
||||
|
||||
void SizerMouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
mov = true;
|
||||
My = MousePosition.Y;
|
||||
Mx = MousePosition.X;
|
||||
Sw = Width;
|
||||
Sh = Height;
|
||||
}
|
||||
|
||||
void SizerMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (mov == true)
|
||||
{
|
||||
Width = MousePosition.X - Mx + Sw;
|
||||
Height = MousePosition.Y - My + Sh;
|
||||
}
|
||||
}
|
||||
|
||||
void SizerMouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
mov = false;
|
||||
}
|
||||
|
||||
public override Size MinimumSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.MinimumSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.MinimumSize = new Size(179, 51);
|
||||
}
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
CreateParams cp = base.CreateParams;
|
||||
// turn on WS_EX_TOOLWINDOW style bit
|
||||
cp.ExStyle |= 0x80;
|
||||
return cp;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
//if (m.Msg == 0x84)
|
||||
//{ // Trap WM_NCHITTEST
|
||||
// Point pos = new Point(m.LParam.ToInt32());
|
||||
// pos = this.PointToClient(pos);
|
||||
// if (pos.Y < cCaption)
|
||||
// {
|
||||
// m.Result = (IntPtr)2; // HTCAPTION
|
||||
// return;
|
||||
// }
|
||||
// if (pos.X >= this.ClientSize.Width - cGrip && pos.Y >= this.ClientSize.Height - cGrip)
|
||||
// {
|
||||
// m.Result = (IntPtr)17; // HTBOTTOMRIGHT
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
int x = (int)(m.LParam.ToInt64() & 0xFFFF); //get x mouse position
|
||||
int y = (int)((m.LParam.ToInt64() & 0xFFFF0000) >> 16); //get y mouse position you can gave (x,y) it from "MouseEventArgs" too
|
||||
Point pt = PointToClient(new Point(x, y));
|
||||
|
||||
if (m.Msg == 0x84)
|
||||
{
|
||||
switch (resize.getMosuePosition(pt, this))
|
||||
{
|
||||
case "l": m.Result = (IntPtr)10; return; // the Mouse on Left Form
|
||||
case "r": m.Result = (IntPtr)11; return; // the Mouse on Right Form
|
||||
case "a": m.Result = (IntPtr)12; return;
|
||||
case "la": m.Result = (IntPtr)13; return;
|
||||
case "ra": m.Result = (IntPtr)14; return;
|
||||
case "u": m.Result = (IntPtr)15; return;
|
||||
case "lu": m.Result = (IntPtr)16; return;
|
||||
case "ru": m.Result = (IntPtr)17; return; // the Mouse on Right_Under Form
|
||||
case "": m.Result = pt.Y < 32 /*mouse on title Bar*/ ? (IntPtr)2 : (IntPtr)1; return;
|
||||
|
||||
}
|
||||
}
|
||||
else if (m.Msg == WM_NCLBUTTONDBLCLK)
|
||||
{
|
||||
m.Result = IntPtr.Zero;
|
||||
return;
|
||||
}
|
||||
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public const int WM_NCLBUTTONDOWN = 0xA1;
|
||||
public const int HT_CAPTION = 0x2;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ReleaseCapture();
|
||||
|
||||
private void button1_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
ReleaseCapture();
|
||||
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Browser_Click(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetDefaultButtonDesign(Button b)
|
||||
{
|
||||
b.BackColor = Color.Black;
|
||||
b.FlatStyle = FlatStyle.Flat;
|
||||
b.FlatAppearance.BorderColor = Color.White;
|
||||
b.FlatAppearance.BorderSize = 1;
|
||||
|
||||
b.GotFocus += (s, e) =>
|
||||
{
|
||||
this.Focus();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private void Form2_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
Form1.WidgetWindows.Add(this);
|
||||
Form1.Widgets.Add(widget);
|
||||
|
||||
foreach (var btn in this.Controls.OfType<Button>())
|
||||
{
|
||||
SetDefaultButtonDesign(btn);
|
||||
}
|
||||
|
||||
//webBrowser1.ScriptErrorsSuppressed = true;
|
||||
//webBrowser1.ScrollBarsEnabled = false;
|
||||
//webBrowser1.DocumentText = Embed;
|
||||
|
||||
|
||||
|
||||
this.FormClosing += (s, eargs) =>
|
||||
{
|
||||
if (deletingWidget)
|
||||
{
|
||||
Form1.WidgetWindows.Remove(this);
|
||||
Form1.Widgets.Remove(this.widget);
|
||||
|
||||
browser.Dispose();
|
||||
}
|
||||
else if (Form1.BeginningShutdown)
|
||||
{
|
||||
//browser.Dispose();
|
||||
}
|
||||
else
|
||||
eargs.Cancel = true;
|
||||
};
|
||||
|
||||
WindowTitle.MouseDown += (s, eargs) => //allows for title (label) to still allow movement but comes at the cost of not being able to check double click with lmb
|
||||
{
|
||||
if (eargs.Button == MouseButtons.Left)
|
||||
{
|
||||
ReleaseCapture();
|
||||
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
|
||||
}
|
||||
};
|
||||
|
||||
WindowTitle.MouseClick += (s, eargs) =>
|
||||
{
|
||||
if (eargs.Button == MouseButtons.Middle)
|
||||
{
|
||||
UpdateTitle();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
|
||||
private const UInt32 SWP_NOSIZE = 0x0001;
|
||||
private const UInt32 SWP_NOMOVE = 0x0002;
|
||||
private const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
||||
//{
|
||||
// string tagUpper = "";
|
||||
|
||||
// foreach (HtmlElement tag in (sender as WebBrowser).Document.All)
|
||||
// {
|
||||
// tagUpper = tag.TagName.ToUpper();
|
||||
|
||||
// if ((tagUpper == "AREA") || (tagUpper == "A"))
|
||||
// {
|
||||
// tag.MouseUp += new HtmlElementEventHandler(this.link_MouseUp);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//void link_MouseUp(object sender, HtmlElementEventArgs e)
|
||||
//{
|
||||
// Regex pattern = new Regex("href=\\\"(.+?)\\\"");
|
||||
// Match match = pattern.Match((sender as HtmlElement).OuterHtml);
|
||||
// string link = match.Groups[1].Value;
|
||||
|
||||
// //Process.Start(link);
|
||||
// Debug.WriteLine("MOUSE UP: " + link);
|
||||
//}
|
||||
|
||||
|
||||
//private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
||||
//{
|
||||
// Debug.WriteLine("COMPLETED");
|
||||
|
||||
|
||||
// //this.Width = webBrowser1.Document.Window.Size.Width + 40;
|
||||
// //this.Height = webBrowser1.Document.Window.Size.Height + 40;
|
||||
|
||||
// //this.Width = webBrowser1.Document.Body.ScrollRectangle.Width + 40;//Border
|
||||
// //this.Height = webBrowser1.Document.Body.ScrollRectangle.Height + 40;//Border
|
||||
|
||||
// //If the control is not docked
|
||||
// //webBrowser1.Size = webBrowser1.Document.Body.ScrollRectangle.Size;
|
||||
//}
|
||||
|
||||
//private void webBrowser1_NewWindow(object sender, CancelEventArgs e)
|
||||
//{
|
||||
// Debug.WriteLine("NEW WINDOW");
|
||||
// e.Cancel = true;
|
||||
|
||||
// var webbrowser = (WebBrowser)sender;
|
||||
// //OpenWebsite(webbrowser.StatusText.ToString());
|
||||
// //Debug.WriteLine(webBrowser1.StatusText.ToString());
|
||||
// //Process.Start(webBrowser1.StatusText.ToString());
|
||||
// webbrowser = null;
|
||||
|
||||
//}
|
||||
|
||||
public class BrowserLifeSpanHandler : ILifeSpanHandler
|
||||
{
|
||||
|
||||
public bool DoClose(IWebBrowser browserControl, IBrowser browser)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnAfterCreated(IWebBrowser browserControl, IBrowser browser)
|
||||
{
|
||||
|
||||
}
|
||||
public void OnBeforeClose(IWebBrowser browserControl, IBrowser browser)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Popup Window
|
||||
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser)
|
||||
{
|
||||
newBrowser = null;
|
||||
|
||||
DialogResult dr = MessageBox.Show(new Form { TopMost = true }, "Would you like to open this 'Popup' in your browser?\n" + "\"" + targetUrl + "\"", "Popup Opening Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
|
||||
if (dr == DialogResult.Yes)
|
||||
Process.Start(targetUrl);
|
||||
//MessageBox.Show("User Clicked:" + targetUrl);
|
||||
|
||||
return true;
|
||||
|
||||
//return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class BrowserRequestHandler : IRequestHandler
|
||||
{
|
||||
//Link Click
|
||||
public bool OnBeforeBrowse(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect)
|
||||
{
|
||||
ignoreLinkLoadingStateChanged = true;
|
||||
|
||||
//Open in Default browser
|
||||
//MessageBox.Show("REQUEST TYPE: " + request.TransitionType.ToString());
|
||||
|
||||
////if ()
|
||||
|
||||
if (/*!request.Url.StartsWith("file:") && */(request.Url.StartsWith("http") || request.Url.StartsWith("www")) && (request.TransitionType == TransitionType.ClientRedirect || request.TransitionType == TransitionType.LinkClicked))
|
||||
{
|
||||
DialogResult dr = MessageBox.Show("Would you like to open this 'Link' in your browser?\n" + "\"" + request.Url + "\"", "Link Opening Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
|
||||
if (dr == DialogResult.Yes)
|
||||
Process.Start(request.Url);
|
||||
|
||||
return true;
|
||||
//return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture)
|
||||
{
|
||||
//MessageBox.Show("ON OPEN URL FROM TAB: " + userGesture.ToString());
|
||||
//MessageBox.Show(targetUrl);
|
||||
//if ((targetUrl.StartsWith("http") || targetUrl.StartsWith("www")))
|
||||
//{
|
||||
// MessageBox.Show(targetUrl);
|
||||
// //System.Diagnostics.Process.Start(request.Url);
|
||||
// return true;
|
||||
//}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
|
||||
{
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath)
|
||||
{
|
||||
throw new Exception("Plugin crashed!");
|
||||
}
|
||||
|
||||
public CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request,
|
||||
IRequestCallback callback)
|
||||
{
|
||||
return CefReturnValue.Continue;
|
||||
}
|
||||
|
||||
public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, string originUrl, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback)
|
||||
{
|
||||
//NOTE: We also suggest you explicitly Dispose of the callback as it wraps an unmanaged resource.
|
||||
|
||||
//Example #1
|
||||
//Spawn a Task to execute our callback and return true;
|
||||
//Typical usage would see you invoke onto the UI thread to open a username/password dialog
|
||||
//Then execute the callback with the response username/password
|
||||
//You can cast the IWebBrowser param to ChromiumWebBrowser to easily access
|
||||
//control, from there you can invoke onto the UI thread, should be in an async fashion
|
||||
//Load https://httpbin.org/basic-auth/cefsharp/passwd in the browser to test
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// using (callback)
|
||||
// {
|
||||
// if (originUrl.Contains("https://httpbin.org/basic-auth/"))
|
||||
// {
|
||||
// var parts = originUrl.Split('/');
|
||||
// var username = parts[parts.Length - 2];
|
||||
// var password = parts[parts.Length - 1];
|
||||
// callback.Continue(username, password);
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
|
||||
//return true;
|
||||
|
||||
//Example #2
|
||||
//Return false to cancel the request
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnDocumentAvailableInMainFrame(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public IResourceRequestHandler GetResourceRequestHandler(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, bool isNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling)
|
||||
{
|
||||
//NOTE: In most cases you examine the request.Url and only handle requests you are interested in
|
||||
if (request.Url.ToLower().StartsWith("https://cefsharp.example")
|
||||
//|| request.Url.ToLower().StartsWith(CefSharpSchemeHandlerFactory.SchemeName) //idk!
|
||||
|| request.Url.ToLower().StartsWith("mailto:")
|
||||
|| request.Url.ToLower().StartsWith("https://googlechrome.github.io/samples/service-worker/"))
|
||||
{
|
||||
return new ResourceRequestHandler();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy, string host, int port,
|
||||
X509Certificate2Collection certificates, ISelectClientCertificateCallback callback)
|
||||
{
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status)
|
||||
{
|
||||
throw new Exception("Browser render process is terminated!");
|
||||
}
|
||||
|
||||
public bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize,
|
||||
IRequestCallback callback)
|
||||
{
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, ref string newUrl)
|
||||
{
|
||||
var url = newUrl;
|
||||
newUrl = url;
|
||||
}
|
||||
|
||||
public bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url)
|
||||
{
|
||||
return url.StartsWith("mailto");
|
||||
}
|
||||
|
||||
public void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request,
|
||||
IResponse response)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request,
|
||||
IResponse response, UrlRequestStatus status, long receivedContentLength)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ZoomOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetZoomLevel(-0.25);
|
||||
}
|
||||
|
||||
private void ZoomIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetZoomLevel(+0.25);
|
||||
}
|
||||
|
||||
public void SetZoomLevel(double scale)
|
||||
{
|
||||
double newZoom = browser.GetZoomLevelAsync().Result + scale;
|
||||
browser.SetZoomLevel(newZoom);
|
||||
|
||||
widget.WidgetZoomScale = newZoom;
|
||||
}
|
||||
|
||||
private void Reload_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (widget.WidgetLoadType == LoadType.HTMLEmbed)
|
||||
browser.LoadHtml(widget.WidgetWebData, false);
|
||||
else if (widget.WidgetLoadType == LoadType.WebsiteURL)
|
||||
browser.Load(widget.WidgetWebData);
|
||||
|
||||
}
|
||||
|
||||
bool deletingWidget = false;
|
||||
private void Exit_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
DialogResult dr = MessageBox.Show("Would you delete the widget \"" + WindowTitle.Text + "\"?\nIt will be permanently deleted.\n(This can be undone by not saving the current widgets)", "Delete Widget?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
deletingWidget = true;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void RenameTitle(string Title)
|
||||
{
|
||||
WindowTitle.Text = Title;
|
||||
}
|
||||
}
|
||||
|
||||
class ReSize
|
||||
{
|
||||
|
||||
private bool Above, Right, Under, Left, Right_above, Right_under, Left_under, Left_above;
|
||||
|
||||
|
||||
int Thickness = 6; //Thickness of border u can cheang it
|
||||
int Area = 8; //Thickness of Angle border
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="thickness">set thickness of form border</param>
|
||||
public ReSize(int thickness)
|
||||
{
|
||||
Thickness = thickness;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor set thickness of form border=1
|
||||
/// </summary>
|
||||
public ReSize()
|
||||
{
|
||||
Thickness = 10;
|
||||
}
|
||||
|
||||
//Get Mouse Position
|
||||
public string getMosuePosition(Point mouse, Form form)
|
||||
{
|
||||
bool above_underArea = mouse.X > Area && mouse.X < form.ClientRectangle.Width - Area; /* |\AngleArea(Left_Above)\(=======above_underArea========)/AngleArea(Right_Above)/| */ //Area===>(==)
|
||||
bool right_left_Area = mouse.Y > Area && mouse.Y < form.ClientRectangle.Height - Area;
|
||||
|
||||
bool _Above = mouse.Y <= Thickness; //Mouse in Above All Area
|
||||
bool _Right = mouse.X >= form.ClientRectangle.Width - Thickness;
|
||||
bool _Under = mouse.Y >= form.ClientRectangle.Height - Thickness;
|
||||
bool _Left = mouse.X <= Thickness;
|
||||
|
||||
Above = _Above && (above_underArea); if (Above) return "a"; /*Mouse in Above All Area WithOut Angle Area */
|
||||
Right = _Right && (right_left_Area); if (Right) return "r";
|
||||
Under = _Under && (above_underArea); if (Under) return "u";
|
||||
Left = _Left && (right_left_Area); if (Left) return "l";
|
||||
|
||||
|
||||
Right_above =/*Right*/ (_Right && (!right_left_Area)) && /*Above*/ (_Above && (!above_underArea)); if (Right_above) return "ra"; /*if Mouse Right_above */
|
||||
Right_under =/* Right*/((_Right) && (!right_left_Area)) && /*Under*/(_Under && (!above_underArea)); if (Right_under) return "ru"; //if Mouse Right_under
|
||||
Left_under = /*Left*/((_Left) && (!right_left_Area)) && /*Under*/ (_Under && (!above_underArea)); if (Left_under) return "lu"; //if Mouse Left_under
|
||||
Left_above = /*Left*/((_Left) && (!right_left_Area)) && /*Above*/(_Above && (!above_underArea)); if (Left_above) return "la"; //if Mouse Left_above
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Widget
|
||||
{
|
||||
public string WidgetTitle;
|
||||
public string WidgetWebData;
|
||||
public Form2.LoadType WidgetLoadType;
|
||||
public double WidgetZoomScale;
|
||||
public Size WidgetWindowSize;
|
||||
public Point WidgetLocation;
|
||||
}
|
||||
}
|
120
src/Form2.resx
Executable file
120
src/Form2.resx
Executable file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
98
src/InputBox.Designer.cs
generated
Executable file
98
src/InputBox.Designer.cs
generated
Executable file
@ -0,0 +1,98 @@
|
||||
namespace WidgetEmbed
|
||||
{
|
||||
partial class InputBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.OKButton = new System.Windows.Forms.Button();
|
||||
this.CancelButton = new System.Windows.Forms.Button();
|
||||
this.TextInput = new System.Windows.Forms.TextBox();
|
||||
this.MessageLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OKButton
|
||||
//
|
||||
this.OKButton.Location = new System.Drawing.Point(243, 21);
|
||||
this.OKButton.Name = "OKButton";
|
||||
this.OKButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.OKButton.TabIndex = 0;
|
||||
this.OKButton.Text = "OK";
|
||||
this.OKButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
this.CancelButton.Location = new System.Drawing.Point(243, 50);
|
||||
this.CancelButton.Name = "CancelButton";
|
||||
this.CancelButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.CancelButton.TabIndex = 1;
|
||||
this.CancelButton.Text = "Cancel";
|
||||
this.CancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// TextInput
|
||||
//
|
||||
this.TextInput.Location = new System.Drawing.Point(12, 104);
|
||||
this.TextInput.Name = "TextInput";
|
||||
this.TextInput.Size = new System.Drawing.Size(306, 20);
|
||||
this.TextInput.TabIndex = 2;
|
||||
//
|
||||
// MessageLabel
|
||||
//
|
||||
this.MessageLabel.AutoSize = true;
|
||||
this.MessageLabel.Location = new System.Drawing.Point(9, 9);
|
||||
this.MessageLabel.Name = "MessageLabel";
|
||||
this.MessageLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.MessageLabel.TabIndex = 3;
|
||||
this.MessageLabel.Text = "Message";
|
||||
//
|
||||
// InputBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(330, 136);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.MessageLabel);
|
||||
this.Controls.Add(this.TextInput);
|
||||
this.Controls.Add(this.CancelButton);
|
||||
this.Controls.Add(this.OKButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Name = "InputBox";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "InputBox";
|
||||
this.Load += new System.EventHandler(this.InputBox_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button OKButton;
|
||||
private System.Windows.Forms.Button CancelButton;
|
||||
private System.Windows.Forms.TextBox TextInput;
|
||||
private System.Windows.Forms.Label MessageLabel;
|
||||
}
|
||||
}
|
81
src/InputBox.cs
Executable file
81
src/InputBox.cs
Executable file
@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WidgetEmbed
|
||||
{
|
||||
public partial class InputBox : Form
|
||||
{
|
||||
public InputBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static InputBox Instance;
|
||||
private void InputBox_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
this.TopMost = true;
|
||||
|
||||
|
||||
TextInput.TextChanged += (s, eargs) =>
|
||||
{
|
||||
if (TextInput.TextLength == 0)
|
||||
OKButton.Enabled = false;
|
||||
else
|
||||
OKButton.Enabled = true;
|
||||
};
|
||||
|
||||
OKButton.Click += (s, eargs) =>
|
||||
{
|
||||
returnMessage.SetResult(TextInput.Text);
|
||||
};
|
||||
|
||||
CancelButton.Click += (s, eargs) =>
|
||||
{
|
||||
returnMessage.SetResult("");
|
||||
};
|
||||
|
||||
this.FormClosing += (s, eargs) =>
|
||||
{
|
||||
eargs.Cancel = true;
|
||||
|
||||
if (returnMessage != null)
|
||||
returnMessage.SetResult("");
|
||||
};
|
||||
}
|
||||
|
||||
TaskCompletionSource<string> returnMessage;
|
||||
public async Task<string> Show(string Message, string Title, string DefaultText = "", int maxTextLength = 0) //Check if there are issues and things that need to be invoked.
|
||||
{
|
||||
|
||||
OKButton.Enabled = false;
|
||||
|
||||
if (DefaultText.Length > 0)
|
||||
OKButton.Enabled = true;
|
||||
|
||||
MessageLabel.Text = Message;
|
||||
this.Text = Title;
|
||||
TextInput.MaxLength = maxTextLength;
|
||||
TextInput.Text = DefaultText;
|
||||
|
||||
this.ShowInTaskbar = true;
|
||||
this.Visible = true;
|
||||
|
||||
|
||||
returnMessage = new TaskCompletionSource<string>();
|
||||
await returnMessage.Task;
|
||||
|
||||
this.Visible = false;
|
||||
this.ShowInTaskbar = false;
|
||||
|
||||
return returnMessage.Task.Result;
|
||||
}
|
||||
}
|
||||
}
|
120
src/InputBox.resx
Executable file
120
src/InputBox.resx
Executable file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
34
src/Program.cs
Executable file
34
src/Program.cs
Executable file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WidgetEmbed
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
static string appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), true)[0]).Value;
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
using (Mutex mutex = new Mutex(false, "Global\\" + appGuid))
|
||||
{
|
||||
if (!mutex.WaitOne(0, false))
|
||||
{
|
||||
MessageBox.Show(new Form { TopMost = true }, "Program instance is already running!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
src/Properties/AssemblyInfo.cs
Executable file
36
src/Properties/AssemblyInfo.cs
Executable file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WidgetEmbed")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WidgetEmbed")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4b3d30ee-2039-4ca9-b2ac-30e3b321dfdb")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
src/Properties/Resources.Designer.cs
generated
Executable file
71
src/Properties/Resources.Designer.cs
generated
Executable file
@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WidgetEmbed.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WidgetEmbed.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
src/Properties/Resources.resx
Executable file
117
src/Properties/Resources.resx
Executable file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
30
src/Properties/Settings.Designer.cs
generated
Executable file
30
src/Properties/Settings.Designer.cs
generated
Executable file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WidgetEmbed.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
src/Properties/Settings.settings
Executable file
7
src/Properties/Settings.settings
Executable file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
159
src/WidgetEmbed.csproj
Executable file
159
src/WidgetEmbed.csproj
Executable file
@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="packages\CefSharp.WinForms.83.4.20\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.83.4.20\build\CefSharp.WinForms.props')" />
|
||||
<Import Project="packages\CefSharp.Common.83.4.20\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.83.4.20\build\CefSharp.Common.props')" />
|
||||
<Import Project="packages\cef.redist.x86.83.4.2\build\cef.redist.x86.props" Condition="Exists('packages\cef.redist.x86.83.4.2\build\cef.redist.x86.props')" />
|
||||
<Import Project="packages\cef.redist.x64.83.4.2\build\cef.redist.x64.props" Condition="Exists('packages\cef.redist.x64.83.4.2\build\cef.redist.x64.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>WidgetEmbed</RootNamespace>
|
||||
<AssemblyName>WidgetEmbed</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CefSharp">
|
||||
<HintPath>packages\CefSharp.Common.83.4.20\CefSharp\x64\CefSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CefSharp.WinForms">
|
||||
<HintPath>packages\CefSharp.WinForms.83.4.20\CefSharp\x64\CefSharp.WinForms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Form2.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form2.Designer.cs">
|
||||
<DependentUpon>Form2.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="InputBox.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="InputBox.Designer.cs">
|
||||
<DependentUpon>InputBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Form2.resx">
|
||||
<DependentUpon>Form2.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="InputBox.resx">
|
||||
<DependentUpon>InputBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\cef.redist.x64.83.4.2\build\cef.redist.x64.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x64.83.4.2\build\cef.redist.x64.props'))" />
|
||||
<Error Condition="!Exists('packages\cef.redist.x86.83.4.2\build\cef.redist.x86.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x86.83.4.2\build\cef.redist.x86.props'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.Common.83.4.20\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.83.4.20\build\CefSharp.Common.props'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.Common.83.4.20\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.83.4.20\build\CefSharp.Common.targets'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.WinForms.83.4.20\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.83.4.20\build\CefSharp.WinForms.props'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.WinForms.83.4.20\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.83.4.20\build\CefSharp.WinForms.targets'))" />
|
||||
</Target>
|
||||
<Import Project="packages\CefSharp.Common.83.4.20\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.83.4.20\build\CefSharp.Common.targets')" />
|
||||
<Import Project="packages\CefSharp.WinForms.83.4.20\build\CefSharp.WinForms.targets" Condition="Exists('packages\CefSharp.WinForms.83.4.20\build\CefSharp.WinForms.targets')" />
|
||||
</Project>
|
31
src/WidgetEmbed.sln
Executable file
31
src/WidgetEmbed.sln
Executable file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29519.87
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WidgetEmbed", "WidgetEmbed.csproj", "{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}.Debug|x64.ActiveCfg = Release|x64
|
||||
{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}.Debug|x64.Build.0 = Release|x64
|
||||
{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}.Release|x64.ActiveCfg = Release|x64
|
||||
{4B3D30EE-2039-4CA9-B2AC-30E3B321DFDB}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {AA9B9649-159D-472E-BE35-9A8BD03C9ED6}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
7
src/packages.config
Executable file
7
src/packages.config
Executable file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="cef.redist.x64" version="83.4.2" targetFramework="net472" />
|
||||
<package id="cef.redist.x86" version="83.4.2" targetFramework="net472" />
|
||||
<package id="CefSharp.Common" version="83.4.20" targetFramework="net472" />
|
||||
<package id="CefSharp.WinForms" version="83.4.20" targetFramework="net472" />
|
||||
</packages>
|
Reference in New Issue
Block a user