Updated from production

This commit is contained in:
Ray 2022-11-06 00:33:06 +00:00
parent 68c929b7cb
commit 0c77a27949
211 changed files with 581 additions and 4308 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
2018/01/2018-01-13-1640.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -6,208 +6,163 @@ using System.Windows.Forms;
namespace RyzStudio.Net namespace RyzStudio.Net
{ {
public class HttpWeb public class HttpWeb
{ {
public string defaultUserAgent = "Momozilla/5.0 (" + Environment.OSVersion.Platform.ToString() + " ; " + Environment.OSVersion.VersionString + "; " + Application.CurrentCulture.TwoLetterISOLanguageName + ")"; public string defaultUserAgent = "Momozilla/5.0 (" + Environment.OSVersion.Platform.ToString() + " ; " + Environment.OSVersion.VersionString + "; " + Application.CurrentCulture.TwoLetterISOLanguageName + ")";
public int defaultTimeout = 6000; public int defaultTimeout = 6000;
public int defaultMaxRedirect = 8; public int defaultMaxRedirect = 8;
public bool defaultAllowRedirect = true; public bool defaultAllowRedirect = true;
public CookieContainer defaultCookierContainer = null; public CookieContainer defaultCookierContainer = null;
public HttpWeb() public HttpWeb()
{ {
} }
public HttpWebRequest CreateRequest(string requestURL) => this.CreateRequest(requestURL, requestURL); public HttpWebRequest CreateRequest(string url)
{
return this.CreateRequest(url, url);
}
public HttpWebRequest CreateRequest(string requestURL, string referrerURL) public HttpWebRequest CreateRequest(string url, string referrerURL)
{ {
if (defaultCookierContainer == null) if (defaultCookierContainer == null)
{ {
defaultCookierContainer = new CookieContainer(); defaultCookierContainer = new CookieContainer();
} }
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(requestURL); HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); webRequest.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
webRequest.MaximumAutomaticRedirections = defaultMaxRedirect; webRequest.MaximumAutomaticRedirections = defaultMaxRedirect;
webRequest.CookieContainer = defaultCookierContainer; webRequest.CookieContainer = defaultCookierContainer;
webRequest.UserAgent = defaultUserAgent; webRequest.UserAgent = defaultUserAgent;
webRequest.AllowAutoRedirect = defaultAllowRedirect; webRequest.AllowAutoRedirect = defaultAllowRedirect;
webRequest.Timeout = defaultTimeout; webRequest.Timeout = defaultTimeout;
webRequest.Referer = referrerURL;
return webRequest; return webRequest;
} }
public int GetResponse(out string sourceCode, string requestURL) => this.GetResponse(out sourceCode, this.CreateRequest(requestURL)); public int GetResponse(out string sourceCode, string url, string referrerURL = "")
{
HttpWebRequest webRequest = this.CreateRequest(url, referrerURL);
public int GetResponse(out string sourceCode, string requestURL, string referrerURL) => this.GetResponse(out sourceCode, this.CreateRequest(requestURL, referrerURL)); return GetResponse(out sourceCode, webRequest);
}
public int GetResponse(out string sourceCode, HttpWebRequest webRequest) public int GetResponse(out string sourceCode, HttpWebRequest webRequest)
{ {
sourceCode = string.Empty; sourceCode = string.Empty;
int rv = 0; int rv = 0;
try try
{ {
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
rv = (int)webResponse.StatusCode; rv = (int)webResponse.StatusCode;
StreamReader readContent = new StreamReader(webResponse.GetResponseStream()); StreamReader readContent = new StreamReader(webResponse.GetResponseStream());
sourceCode = readContent.ReadToEnd(); sourceCode = readContent.ReadToEnd();
webResponse.Close(); webResponse.Close();
webResponse = null; webResponse = null;
} }
catch (WebException xc) catch (WebException xc)
{ {
if (xc.Response is HttpWebResponse) if (xc.Response is HttpWebResponse)
{ {
HttpWebResponse rs = xc.Response as HttpWebResponse; HttpWebResponse rs = xc.Response as HttpWebResponse;
StreamReader readContent = new StreamReader(rs.GetResponseStream()); StreamReader readContent = new StreamReader(rs.GetResponseStream());
if (readContent != null) if (readContent != null)
{ {
sourceCode = readContent.ReadToEnd(); sourceCode = readContent.ReadToEnd();
} }
rv = (int)rs.StatusCode; rv = (int)rs.StatusCode;
} }
else else
{ {
rv = (int)xc.Status; rv = (int)xc.Status;
sourceCode = xc.Message; sourceCode = xc.Message;
} }
} }
catch (Exception xc) catch (Exception xc)
{ {
sourceCode = xc.Message; sourceCode = xc.Message;
} }
return rv; return rv;
} }
public int GetResponse(out HttpWebRequest webRequest, out string sourceCode, string requestURL) => this.GetResponse(out webRequest, out sourceCode, requestURL, requestURL, true); public static HttpWebRequest AddBasicAuthentication(HttpWebRequest webRequest, string username, string password)
{
webRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(string.Concat(username, ":", password)));
webRequest.PreAuthenticate = true;
public int GetResponse(out HttpWebRequest webRequest, out string sourceCode, string requestURL, bool allowAutoRedirect) => this.GetResponse(out webRequest, out sourceCode, requestURL, requestURL, allowAutoRedirect); return webRequest;
}
public int GetResponse(out HttpWebRequest webRequest, out string sourceCode, string requestURL, string referrerURL) => this.GetResponse(out webRequest, out sourceCode, requestURL, referrerURL, true);
public int GetResponse(out HttpWebRequest webRequest, out string sourceCode, string requestURL, string referrerURL, bool allowAutoRedirect) public int GetPOSTResponse(out string sourceCode, HttpWebRequest webRequest, string postData)
{ {
webRequest = this.CreateRequest(requestURL, referrerURL); sourceCode = "";
webRequest.AllowAutoRedirect = allowAutoRedirect; int rv = 0;
byte[] buffer = Encoding.UTF8.GetBytes(postData);
return this.GetResponse(out sourceCode, webRequest); webRequest.ContentLength = buffer.Length;
}
public int GetHEADResponse(string requestURL) => this.GetHEADResponse(requestURL, requestURL, true); try
{
Stream dataStream = webRequest.GetRequestStream();
dataStream.Write(buffer, 0, buffer.Length);
dataStream.Close();
}
catch (Exception xc)
{
sourceCode = xc.Message;
return rv;
}
public int GetHEADResponse(string requestURL, string referrerURL) => this.GetHEADResponse(requestURL, requestURL, true); return this.GetResponse(out sourceCode, webRequest);
}
public int GetHEADResponse(string requestURL, bool allowAutoRedirect) => this.GetHEADResponse(requestURL, requestURL, allowAutoRedirect); public int GetHeader(out WebHeaderCollection headerCollection, string url, string referrerURL = "")
{
headerCollection = null;
public int GetHEADResponse(string requestURL, string referrerURL, bool allowAutoRedirect) int rv = 0;
{
HttpWebRequest webRequest = this.CreateRequest(requestURL, referrerURL);
webRequest.Method = "HEAD";
webRequest.AllowAutoRedirect = allowAutoRedirect;
string sc; HttpWebRequest webRequest = this.CreateRequest(url, referrerURL);
int rc = this.GetResponse(out sc, webRequest); webRequest.Method = "HEAD";
return rc; try
} {
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
headerCollection = webResponse.Headers;
public int GetHEADResponse(out HttpWebRequest webRequest, string requestURL) => this.GetHEADResponse(out webRequest, requestURL, requestURL, true); rv = (int)webResponse.StatusCode;
public int GetHEADResponse(out HttpWebRequest webRequest, string requestURL, string referrerURL) => this.GetHEADResponse(out webRequest, requestURL, referrerURL, true); webResponse.Close();
webResponse = null;
}
catch (WebException xc)
{
if (xc.Response is HttpWebResponse)
{
HttpWebResponse rs = xc.Response as HttpWebResponse;
public int GetHEADResponse(out HttpWebRequest webRequest, string requestURL, bool allowAutoRedirect) => this.GetHEADResponse(out webRequest, requestURL, requestURL, allowAutoRedirect); rv = (int)rs.StatusCode;
}
else
{
rv = (int)xc.Status;
}
}
catch (Exception xc)
{
// do nothing
}
public int GetHEADResponse(out HttpWebRequest webRequest, string requestURL, string referrerURL, bool allowAutoRedirect) return rv;
{ }
webRequest = this.CreateRequest(requestURL, referrerURL); }
webRequest.Method = "HEAD";
webRequest.AllowAutoRedirect = allowAutoRedirect;
string sc;
int rc = this.GetResponse(out sc, webRequest);
return rc;
}
public int GetPOSTResponse(out string sourceCode, HttpWebRequest webRequest, string postData)
{
sourceCode = string.Empty;
int rv = 0;
byte[] buffer = Encoding.UTF8.GetBytes(postData);
webRequest.ContentLength = buffer.Length;
try
{
Stream dataStream = webRequest.GetRequestStream();
dataStream.Write(buffer, 0, buffer.Length);
dataStream.Close();
}
catch (Exception xc)
{
sourceCode = xc.Message;
return rv;
}
return this.GetResponse(out sourceCode, webRequest);
}
public int GetHeader(out WebHeaderCollection headerCollection, string url, string referrerURL = "")
{
headerCollection = null;
int rv = 0;
HttpWebRequest webRequest = this.CreateRequest(url, referrerURL);
webRequest.Method = "HEAD";
try
{
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
headerCollection = webResponse.Headers;
rv = (int)webResponse.StatusCode;
webResponse.Close();
webResponse = null;
}
catch (WebException xc)
{
if (xc.Response is HttpWebResponse)
{
HttpWebResponse rs = xc.Response as HttpWebResponse;
rv = (int)rs.StatusCode;
}
else
{
rv = (int)xc.Status;
}
}
catch (Exception xc)
{
// do nothing
}
return rv;
}
public static HttpWebRequest AddBasicAuthentication(HttpWebRequest webRequest, string username, string password)
{
webRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(string.Concat(username, ":", password)));
webRequest.PreAuthenticate = true;
return webRequest;
}
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1,248 +0,0 @@
using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security;
using System.Text;
namespace HiImRay
{
public class Docxument
{
protected string Filename { get; set; }
public int CompressionLevel { get; set; } = 9;
public Dictionary<string, string> ReplacementWords = new Dictionary<string, string>();
public Dictionary<string, List<Dictionary<string, string>>> ReplacementParagraphs = new Dictionary<string, List<Dictionary<string, string>>>();
public Docxument()
{
}
public Docxument(string filename)
{
Load(filename);
}
public void Load(string filename)
{
this.Filename = filename;
}
public void Save(string saveFilename)
{
int size = 2048;
byte[] buffer = new byte[size];
int bufferSize = 0;
// read file
ZipEntry readEntry = null;
ZipInputStream readStream = new ZipInputStream(File.OpenRead(this.Filename));
// write file
ZipOutputStream writeStream = new ZipOutputStream(File.Create(saveFilename));
writeStream.SetLevel(this.CompressionLevel);
// loop
while (true)
{
readEntry = readStream.GetNextEntry();
if (readEntry == null)
{
break;
}
if (string.IsNullOrWhiteSpace(readEntry.Name))
{
break;
}
if (!readEntry.IsFile)
{
continue;
}
// change document
if (readEntry.Name.Equals("word/document.xml"))
{
MemoryStream ms = new MemoryStream();
buffer = new byte[size];
bufferSize = 0;
do
{
bufferSize = readStream.Read(buffer, 0, buffer.Length);
ms.Write(buffer, 0, bufferSize);
} while (bufferSize > 0);
ms.Position = 0;
StreamReader sr = new StreamReader(ms);
StringBuilder sb = new StringBuilder();
sb.Append(sr.ReadToEnd());
// make changes
sb = replaceTokens(sb, this.ReplacementWords);
sb = replaceParagraphs(sb, this.ReplacementParagraphs);
// make readable
MemoryStream ms2 = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(sb.ToString()));
ms2.Position = 0;
// write new document xml
writeStream.PutNextEntry(new ZipEntry(readEntry.Name));
buffer = new byte[size];
bufferSize = 0;
do
{
bufferSize = ms2.Read(buffer, 0, buffer.Length);
writeStream.Write(buffer, 0, bufferSize);
} while (bufferSize > 0);
ms2.Close();
ms2.Dispose();
}
else
{
writeStream.PutNextEntry(new ZipEntry(readEntry.Name));
buffer = new byte[size];
bufferSize = 0;
do
{
bufferSize = readStream.Read(buffer, 0, buffer.Length);
writeStream.Write(buffer, 0, bufferSize);
} while (bufferSize > 0);
}
}
writeStream.Finish();
writeStream.Flush();
writeStream.Close();
writeStream.Dispose();
readStream.Close();
readStream.Dispose();
}
protected StringBuilder replaceTokens(StringBuilder sb, Dictionary<string, string> options)
{
foreach (KeyValuePair<string, string> item in options)
{
sb.Replace("{{" + item.Key + "}}", SecurityElement.Escape(item.Value));
}
return sb;
}
protected StringBuilder replaceParagraphs(StringBuilder sb, Dictionary<string, List<Dictionary<string, string>>> options)
{
foreach (KeyValuePair<string, List<Dictionary<string, string>>> item in options)
{
sb = replaceParagraph(sb, item);
}
return sb;
}
protected StringBuilder replaceParagraph(StringBuilder sb, KeyValuePair<string, List<Dictionary<string, string>>> options)
{
string paragraph = sb.ToString();
Tuple<int, int> outerCoord = getOuterParagraph(paragraph, "{{" + options.Key + "}}");
if (outerCoord != null)
{
sb.Remove(outerCoord.Item1, outerCoord.Item2);
Tuple<int, int> innerCoord = getInnerParagraph(paragraph.Substring(outerCoord.Item1, outerCoord.Item2), "{{" + options.Key + "}}");
string innerParagraph = paragraph.Substring((innerCoord.Item1 + outerCoord.Item1), innerCoord.Item2);
StringBuilder innerText = new StringBuilder();
foreach (Dictionary<string, string> row in options.Value)
{
StringBuilder sb2 = new StringBuilder();
sb2.Append(innerParagraph);
sb2 = replaceTokens(sb2, row);
innerText.Append(sb2.ToString());
}
sb.Insert(outerCoord.Item1, innerText.ToString());
}
return sb;
}
protected Tuple<int, int> getOuterParagraph(string fullText, string findTerm)
{
string headTerm = "<w:p ";
string tailTerm = "</w:p>";
int headIndex = fullText.IndexOf(findTerm);
if (headIndex < 0)
{
return null;
}
int tailIndex = fullText.IndexOf(findTerm, (headIndex + findTerm.Length));
if (tailIndex < 0)
{
return null;
}
headIndex = fullText.LastIndexOf(headTerm, headIndex);
if (headIndex < 0)
{
return null;
}
tailIndex = fullText.IndexOf(tailTerm, (tailIndex + tailTerm.Length));
if (tailIndex < 0)
{
return null;
}
tailIndex += tailTerm.Length;
return new Tuple<int, int>(headIndex, (tailIndex - headIndex));
}
protected Tuple<int, int> getInnerParagraph(string fullText, string findTerm)
{
string headTerm = "<w:p ";
string tailTerm = "</w:p>";
int headIndex = fullText.IndexOf(findTerm);
if (headIndex < 0)
{
return null;
}
int tailIndex = fullText.IndexOf(findTerm, (headIndex + findTerm.Length));
if (tailIndex < 0)
{
return null;
}
headIndex = fullText.IndexOf(tailTerm, headIndex);
if (headIndex < 0)
{
return null;
}
headIndex += tailTerm.Length;
tailIndex = fullText.LastIndexOf(headTerm, tailIndex);
if (tailIndex < 0)
{
return null;
}
return new Tuple<int, int>(headIndex, (tailIndex - headIndex));
}
}
}

View File

@ -1,469 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SQLite;
using System.IO;
using System.Text;
namespace RyzStudio.Data.SQLite
{
public class SQLiteDatabase
{
public SQLiteConnection DBConnection { get; protected set; } = null;
public string DBLocation { get; protected set; } = null;
public string LastError { get; protected set; } = null;
public int LastInsertID
{
get
{
if (this.DBConnection == null)
{
return 0;
}
DataTable dt = this.DoQuery("SELECT last_insert_rowid() AS rv;");
if (dt == null)
{
return 0;
}
if (dt.Rows.Count <= 0)
{
return 0;
}
int n;
if (!int.TryParse(dt.Rows[0]["rv"].ToString(), out n))
{
n = 0;
}
return n;
}
}
protected string[] requiredTableList = new string[0];
protected const string appSettingsTableName = "ryz_app_xxxx_config";
public bool Create()
{
this.LastError = string.Empty;
this.DBLocation = ":memory:";
try
{
this.DBConnection = new SQLiteConnection(string.Concat("Data Source=\"", this.DBLocation, "\";Version=3;UTF8Encoding=True;"));
this.DBConnection.Open();
}
catch (Exception exc)
{
this.LastError = exc.Message;
return false;
}
return true;
}
public bool Create(string filename, bool overwriteFile = false, string password = null, bool useAppSettings = false)
{
bool rs = create(filename, overwriteFile, password);
if (useAppSettings)
{
if (!rs)
{
return false;
}
rs = prepareDatabase();
if (!rs)
{
return false;
}
return this.HasRequiredTables();
}
else
{
return rs;
}
}
public bool LoadFile(string filename, string password = null)
{
this.LastError = string.Empty;
if (!File.Exists(filename))
{
return false;
}
this.DBLocation = filename;
try
{
this.DBConnection = new SQLiteConnection(string.Concat("Data Source=\"", filename, "\";Version=3;UTF8Encoding=True;", (password == null) ? string.Empty : string.Concat("Password=", encode64(password), ";")));
this.DBConnection.Open();
}
catch (Exception exc)
{
this.LastError = exc.Message;
return false;
}
return true;
}
public void Close()
{
this.LastError = string.Empty;
if (this.DBConnection != null)
{
try
{
this.DBConnection.Cancel();
this.DBConnection.Close();
this.DBConnection.Dispose();
this.DBConnection = null;
SQLiteConnection.ClearAllPools();
GC.Collect();
}
catch (Exception exc)
{
this.LastError = exc.Message;
}
}
}
public DataTable DoQuery(string query)
{
this.LastError = string.Empty;
if (this.DBConnection == null)
{
return null;
}
try
{
SQLiteCommand command = new SQLiteCommand(query, this.DBConnection);
SQLiteDataReader dr = command.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(dr);
return dt;
}
catch (Exception exc)
{
this.LastError = exc.Message;
return null;
}
}
public DataTable DoQuery(string query, params string[] args) => DoQuery(prepareQuery(query, args));
public int DoQueryCount(string query)
{
this.LastError = string.Empty;
if (this.DBConnection == null)
{
return -1;
}
DataTable dt = this.DoQuery(query);
if (dt == null)
{
return -1;
}
return dt.Rows.Count;
}
public int DoQueryCount(string query, params string[] args) => this.DoQueryCount(prepareQuery(query, args));
public bool DoQueryExist(string query) => (this.DoQueryCount(query) > 0);
public bool DoQueryExist(string query, params string[] args) => this.DoQueryExist(prepareQuery(query, args));
public string DoQuerySingle(string query)
{
this.LastError = string.Empty;
if (this.DBConnection == null)
{
return string.Empty;
}
DataTable dt = this.DoQuery(query);
if (dt == null)
{
return string.Empty;
}
if (dt.Columns.Count <= 0)
{
return string.Empty;
}
if (dt.Rows.Count <= 0)
{
return string.Empty;
}
if (dt.Rows[0][0] is byte[])
{
return Encoding.UTF8.GetString(dt.Rows[0][0] as byte[]);
}
else
{
return dt.Rows[0][0].ToString();
}
}
public string DoQuerySingle(string query, params string[] args) => this.DoQuerySingle(prepareQuery(query, args));
public int DoNonQuery(string query)
{
this.LastError = string.Empty;
if (this.DBConnection == null)
{
return -1;
}
int rv = 0;
try
{
SQLiteCommand command = new SQLiteCommand(query, this.DBConnection);
rv = command.ExecuteNonQuery();
}
catch (Exception exc)
{
this.LastError = exc.Message;
rv = -1;
}
return rv;
}
public int DoNonQuery(string query, params string[] args) => this.DoNonQuery(prepareQuery(query, args));
public bool HasTable(string tableName)
{
this.LastError = string.Empty;
if (this.DBConnection == null)
{
return false;
}
int rv = this.DoQueryCount("SELECT 1 FROM sqlite_master WHERE type='table' AND name='" + escapeSQL(tableName) + "'");
return (rv > 0);
}
public bool HasRequiredTables()
{
bool rv = true;
foreach (string tbl in requiredTableList)
{
if (string.IsNullOrEmpty(tbl))
{
continue;
}
if (!this.HasTable(tbl))
{
rv = false;
break;
}
}
return rv;
}
public bool SetConfig(string name, bool value) => this.SetConfig(name, (value ? "1" : "0"));
public bool SetConfig(string name, int value) => this.SetConfig(name, value.ToString());
public bool SetConfig(string name, string value)
{
prepareAppSettings();
string sql = string.Empty;
int rv = this.DoQueryCount("SELECT 1 FROM " + appSettingsTableName + " WHERE cfg_name='" + escapeSQL(name) + "'");
if (rv <= 0)
{
sql = "INSERT INTO " + appSettingsTableName + " (cfg_name, cfg_value) VALUES ('[^1]', '[^2]');";
}
else
{
sql = "UPDATE " + appSettingsTableName + " SET cfg_value='[^2]' WHERE cfg_name='[^1]';";
}
sql = prepareQuery(sql, new string[] { name, value });
return this.DoNonQuery(sql) > 0;
}
public string GetConfig(string name, string defaultValue = null)
{
prepareAppSettings();
bool rv = this.DoQueryExist("SELECT 1 FROM " + appSettingsTableName + " WHERE cfg_name='" + escapeSQL(name) + "';");
if (!rv)
{
return defaultValue;
}
return this.DoQuerySingle("SELECT cfg_value FROM " + appSettingsTableName + " WHERE cfg_name='" + escapeSQL(name) + "';");
}
public int GetIntConfig(string name, int defaultValue = 0)
{
string rv = this.GetConfig(name);
if (string.IsNullOrWhiteSpace(rv))
{
return defaultValue;
}
int n;
if (!int.TryParse(rv, out n))
{
n = defaultValue;
}
return n;
}
public bool GetBoolConfig(string name, bool defaultValue = false)
{
string rv = this.GetConfig(name);
if (string.IsNullOrWhiteSpace(rv))
{
return defaultValue;
}
if (rv.Equals("1"))
{
return true;
}
if (rv.Equals("true", StringComparison.CurrentCultureIgnoreCase))
{
return true;
}
return false;
}
protected bool create(string filename, bool overwriteFile, string password)
{
this.LastError = string.Empty;
if (File.Exists(filename))
{
if (overwriteFile)
{
try
{
File.Delete(filename);
}
catch (Exception exc)
{
this.LastError = exc.Message;
return false;
}
try
{
SQLiteConnection.CreateFile(filename);
}
catch (Exception exc)
{
this.LastError = exc.Message;
return false;
}
return this.LoadFile(filename, password);
}
else
{
return this.LoadFile(filename, password);
}
}
else
{
try
{
SQLiteConnection.CreateFile(filename);
}
catch (Exception exc)
{
this.LastError = exc.Message;
return false;
}
return this.LoadFile(filename, password);
}
}
protected string prepareQuery(string query, params string[] arguments)
{
string rv = query;
if (string.IsNullOrWhiteSpace(rv))
{
return string.Empty;
}
for (int i = 0; i < arguments.Length; i++)
{
rv = rv.Replace("[^" + (i + 1).ToString() + "]", escapeSQL(arguments[i]));
}
return rv;
}
protected string escapeSQL(string q) => q.Replace("'", "''").Trim();
protected string escapeValue(string text) => text.Replace("\"", "\\\"").Replace("\t", "\\t").Replace("\r", " \\r").Replace("\n", "\\n");
protected string encode64(string text) => Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text));
protected bool prepareAppSettings()
{
if (this.HasTable(appSettingsTableName))
{
return true;
}
int rv = this.DoNonQuery("CREATE TABLE " + appSettingsTableName + " (cfg_name TEXT, cfg_value TEXT)");
return rv > 0;
}
protected virtual bool prepareDatabase()
{
return true;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -1,258 +0,0 @@
namespace RyzStudio.Windows.Forms
{
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
[ToolboxItem(true)]
public class PanelBook : Panel
{
public class PanelCollection : CollectionBase
{
protected PanelBook panelBook = null;
public PanelCollection(PanelBook parentPanelBook) : base()
{
panelBook = parentPanelBook;
}
public PanelBook Parent => panelBook;
public Panel this[int index] { get => (Panel)List[index]; set => List[index] = value; }
public int Add(Panel value) => List.Add(value);
public void AddRange(Panel[] pages) => Array.ForEach(pages, x => this.Add(x));
public bool Contains(Panel value) => List.Contains(value);
public int IndexOf(Panel value) => List.IndexOf(value);
public void Insert(int index, Panel value) => List.Insert(index, value);
public void Remove(Panel value) => List.Remove(value);
protected override void OnInsertComplete(int index, object value)
{
base.OnInsertComplete(index, value);
if (panelBook != null)
{
panelBook.PageIndex = index;
}
}
protected override void OnRemoveComplete(int index, object value)
{
base.OnRemoveComplete(index, value);
if (panelBook != null)
{
if (panelBook.PageIndex == index)
{
if (index < InnerList.Count)
{
panelBook.PageIndex = index;
}
else
{
panelBook.PageIndex = InnerList.Count - 1;
}
}
}
}
}
private System.ComponentModel.IContainer components = null;
protected PanelCollection panelCollection = null;
public PanelBook()
{
InitializeComponent();
panelCollection = new PanelCollection(this);
}
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
protected void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public Panel ActivePanel { get; protected set; } = null;
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override bool AutoScroll { get => base.AutoScroll; set => base.AutoScroll = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Size AutoScrollMargin { get => base.AutoScrollMargin; set => base.AutoScrollMargin = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Size AutoScrollMinSize { get => base.AutoScrollMinSize; set => base.AutoScrollMinSize = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override Image BackgroundImage { get => base.BackgroundImage; set => base.BackgroundImage = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override ImageLayout BackgroundImageLayout { get => base.BackgroundImageLayout; set => base.BackgroundImageLayout = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new ImeMode ImeMode { get => base.ImeMode; set => base.ImeMode = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override RightToLeft RightToLeft { get => base.RightToLeft; set => base.RightToLeft = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new bool UseWaitCursor { get => base.UseWaitCursor; set => base.UseWaitCursor = value; }
[Category("Collection")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PanelCollection Pages => panelCollection;
[Category("Collection")]
public int SelectedIndex
{
get => (panelCollection.Count <= 0) ? -1 : panelCollection.IndexOf(this.ActivePanel);
set
{
if (panelCollection.Count <= 0) return;
if (value < 0) return;
if (value > (panelCollection.Count - 1)) return;
if (value == this.SelectedIndex) return;
ActivatePage(value);
}
}
protected internal int PageIndex
{
get => panelCollection.IndexOf(this.ActivePanel);
set
{
if (panelCollection.Count <= 0)
{
ActivatePage(-1);
return;
}
if ((value < -1) || (value >= panelCollection.Count))
{
throw new ArgumentOutOfRangeException("PageIndex", value, "The page index must be between 0 and " + Convert.ToString(panelCollection.Count - 1));
}
ActivatePage(value);
}
}
protected internal void ActivatePage(int index)
{
if ((panelCollection.Count == 0) && (index >= panelCollection.Count) && (index <= 0))
{
return;
}
Panel p = (Panel)panelCollection[index];
ActivatePage(p);
}
protected internal void ActivatePage(Panel page)
{
if (this.ActivePanel != null)
{
if (this.ActivePanel.InvokeRequired)
{
this.ActivePanel.Invoke(new MethodInvoker(() => {
this.ActivePanel.Visible = false;
}));
}
else
{
this.ActivePanel.Visible = false;
}
}
this.ActivePanel = page;
if (this.ActivePanel != null)
{
this.ActivePanel.Parent = this;
if (!this.Contains(this.ActivePanel))
{
this.Container.Add(this.ActivePanel);
}
if (this.ActivePanel.InvokeRequired)
{
this.ActivePanel.Invoke(new MethodInvoker(() => {
this.ActivePanel.Dock = DockStyle.Fill;
this.ActivePanel.Visible = true;
this.ActivePanel.BringToFront();
}));
}
else
{
this.ActivePanel.Dock = DockStyle.Fill;
this.ActivePanel.Visible = true;
this.ActivePanel.BringToFront();
}
}
if (this.ActivePanel != null)
{
if (this.ActivePanel.InvokeRequired)
{
this.ActivePanel.Invoke(new MethodInvoker(() => {
this.ActivePanel.Invalidate();
}));
}
else
{
this.ActivePanel.Invalidate();
}
}
else
{
this.Invalidate();
}
}
#if DEBUG
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
if (this.DesignMode)
{
this.Invalidate();
}
}
#endif
protected override void DestroyHandle()
{
base.DestroyHandle();
foreach (Panel p in panelCollection)
{
p.Dispose();
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
2019/05/panelbook-page1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
2019/05/panelbook-page2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,112 +0,0 @@
/**
* BSDialog
* @version v0.1.0.024 (2019/07/05 2210)
*/
var BSDialog = {
Create: function(id, title, url, is_big, update_body) {
var a = this;
var isBig = ((typeof(is_big) == "undefined") ? false : (is_big == true) ? true : false);
var updateBody = ((typeof(update_body) == "undefined") ? false : (update_body == true) ? true : false);
if (!a.hasDialog(id)) {
var html = a.generateModalHtml(id, title, null, isBig);
$("body").append(html);
}
$.ajax({
url: url,
cache: false,
timeout: 10000,
success: function(result, status, xhr){
if ((xhr.status == 200) || (xhr.status == 302) || (xhr.status == 301))
{
if (updateBody)
{
a.updateContentBody(id, result);
} else {
$("#dlg" + id).find(".modal-content").html(result);
}
} else {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
}
},
error: function(xhr){
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
},
complete: function(xhr, status){
// do nothing yet
}
});
a.show(id);
},
Close: function(id) {
if (!this.hasDialog(id)) return;
$("#dlg" + id).modal('hide');
},
Clear: function() {
$("body > div[class~='modal'][role='dialog']").remove();
$("body > div[class~='modal-backdrop']").remove();
$("body").removeClass("modal-open");
},
ShowToast: function(id, title, message, is_big) {
if (this.hasDialog(id)) return;
var html = this.generateModalHtml(id, title, message, is_big);
$("body").append(html);
this.show(id);
},
hasDialog: function(id) {
return ($("body > div[id='dlg" + id + "']").length > 0);
},
generateModalHtml: function(id, title, message, is_big) {
var size = ((typeof(is_big) == "undefined") ? "sm" : (is_big == true ? "lg" : "sm"));
var html = "";
html += "<div class=\"modal fade\" id=\"dlg" + id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"dlg" + id + "Label\" aria-hidden=\"true\">";
html += " <div class=\"modal-dialog modal-" + size + "\">";
html += " <div class=\"modal-content\">";
html += " <div class=\"modal-header\">";
html += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>";
html += " <strong class=\"modal-title\">" + title + "</strong>";
html += " </div>";
if ($.trim(message).length <= 0)
{
html += " <div class=\"modal-body custom-loading\"></div>";
} else {
html += " <div class=\"modal-body\">" + message + "</div>";
}
html += " <div class=\"modal-footer\">";
html += " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>";
html += " </div>";
html += " </div>";
html += " </div>";
html += "</div>";
return html;
},
show: function(id) {
$("#dlg" + id).modal('show');
$("#dlg" + id).off('hide.bs.modal');
$("#dlg" + id).on('hide.bs.modal', function() {
if ($("body > div[id='dlg" + id + "']").next().is("div[class~='modal-backdrop']")) {
$("body > div[id='dlg" + id + "']").next().remove();
}
$("body > div[id='dlg" + id + "']").remove();
});
},
updateContentBody: function(id, text) {
var body = $("#dlg" + id).find(".modal-body");
if ($(body).hasClass("custom-loading")) $(body).removeClass("custom-loading");
$(body).html(text);
}
};

View File

@ -1,114 +0,0 @@
/**
* BSDialog
* @version v0.1.0.025 (2019/07/26 1022)
*/
var BSDialog = {
Create: function(id, title, url, is_big, update_body) {
var a = this;
var isBig = ((typeof(is_big) == "undefined") ? false : (is_big == true) ? true : false);
var updateBody = ((typeof(update_body) == "undefined") ? false : (update_body == true) ? true : false);
if (!a.hasDialog(id)) {
var html = a.generateModalHtml(id, title, null, isBig);
$("body").append(html);
}
if (url != null)
{
$.ajax({
url: url,
cache: false,
timeout: 60000,
success: function(result, status, xhr){
if ((xhr.status == 200) || (xhr.status == 302) || (xhr.status == 301))
{
if (updateBody)
{
a.updateContentBody(id, result);
} else {
$("#dlg" + id).find(".modal-content").html(result);
}
} else {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
}
},
error: function(xhr){
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
},
complete: function(xhr, status){
// do nothing yet
}
});
}
a.show(id);
},
Close: function(id) {
if (!this.hasDialog(id)) return;
$("#dlg" + id).modal('hide');
},
Clear: function() {
$("body > div[class~='modal'][role='dialog']").remove();
$("body > div[class~='modal-backdrop']").remove();
$("body").removeClass("modal-open");
},
ShowToast: function(id, title, message, is_big) {
if (this.hasDialog(id)) return;
var html = this.generateModalHtml(id, title, message, is_big);
$("body").append(html);
this.show(id);
},
hasDialog: function(id) {
return ($("body > div[id='dlg" + id + "']").length > 0);
},
generateModalHtml: function(id, title, message, is_big) {
var size = ((typeof(is_big) == "undefined") ? "sm" : (is_big == true ? "lg" : "sm"));
var html = "";
html += "<div class=\"modal fade\" id=\"dlg" + id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"dlg" + id + "Label\" aria-hidden=\"true\">";
html += " <div class=\"modal-dialog modal-" + size + "\">";
html += " <div class=\"modal-content\">";
html += " <div class=\"modal-header\">";
html += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>";
html += " <strong class=\"modal-title\">" + title + "</strong>";
html += " </div>";
if ($.trim(message).length <= 0)
{
html += " <div class=\"modal-body custom-loading\"></div>";
} else {
html += " <div class=\"modal-body\">" + message + "</div>";
}
html += " <div class=\"modal-footer\">";
html += " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>";
html += " </div>";
html += " </div>";
html += " </div>";
html += "</div>";
return html;
},
show: function(id) {
$("#dlg" + id).modal('show');
$("#dlg" + id).off('hide.bs.modal');
$("#dlg" + id).on('hide.bs.modal', function() {
if ($("body > div[id='dlg" + id + "']").next().is("div[class~='modal-backdrop']")) {
$("body > div[id='dlg" + id + "']").next().remove();
}
$("body > div[id='dlg" + id + "']").remove();
});
},
updateContentBody: function(id, text) {
var body = $("#dlg" + id).find(".modal-body");
if ($(body).hasClass("custom-loading")) $(body).removeClass("custom-loading");
$(body).html(text);
}
};

View File

@ -1,152 +0,0 @@
/**
* BSDialog
* @version v0.1.0.026 (2019/08/22 0052)
*/
var BSDialog = {
Create: function (id, title, url, is_big, update_body) {
var a = this;
a.id = id;
a.title = title;
a.url = url;
a.isBig = ((typeof (is_big) == "undefined") ? false : (is_big == true) ? true : false);
var updateBody = ((typeof (update_body) == "undefined") ? true : (update_body == true) ? true : false);
if (!a.Exists(id)) {
a.renderContent(null);
}
if (url != null) {
$.ajax({
url: url,
cache: false,
timeout: 60000,
success: function (result, status, xhr) {
if ((xhr.status == 200) || (xhr.status == 302) || (xhr.status == 301)) {
if (updateBody) {
a.updateContentBody(id, result);
} else {
$("#dlg" + id).find(".modal-content").html(result);
}
} else {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
}
},
error: function (xhr) {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
},
complete: function (xhr, status) {
// do nothing yet
}
});
}
a.initialiseComponents();
},
Close: function (id) {
$("#dlg" + id).modal('hide');
},
Clear: function () {
$("body > div[class~='modal'][role='dialog']").remove();
$("body > div[class~='modal-backdrop']").remove();
$("body").removeClass("modal-open");
},
ShowToast: function (id, title, message, is_big) {
var a = this;
if (a.Exists(id)) {
return;
}
a.id = id;
a.title = title;
a.url = null;
a.isBig = ((typeof (is_big) == "undefined") ? false : (is_big == true) ? true : false);
a.renderContent(message);
a.initialiseComponents();
},
Exists: function (id) {
return ($("body > div[id='dlg" + id + "']").length > 0);
},
generateModalHtml: function (message) {
var a = this;
var size = ((typeof (a.isBig) == "undefined") ? "md" : (a.isBig == true ? "lg" : "md"));
var html = "";
html += "<div class=\"modal fade\" id=\"dlg" + a.id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"dlg" + a.id + "Label\" aria-hidden=\"true\">";
html += " <div class=\"modal-dialog modal-" + size + "\">";
html += " <div class=\"modal-content\">";
html += " <div class=\"modal-header\">";
html += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>";
html += " <span class=\"close\">&nbsp;</span>";
html += " <button type=\"button\" class=\"close\" data-modal-action=\"restore\" aria-hidden=\"true\">&#8722;</button>";
html += " <strong class=\"modal-title\" style=\"cursor:default; \">" + a.title + "</strong>";
html += " </div>";
if ($.trim(message).length <= 0) {
html += " <div class=\"modal-body custom-loading\"></div>";
} else {
html += " <div class=\"modal-body\">" + message + "</div>";
}
html += " <div class=\"modal-footer\">";
html += " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>";
html += " </div>";
html += " </div>";
html += " </div>";
html += "</div>";
return html;
},
renderContent: function (content) {
$("body").append(this.generateModalHtml(content));
},
initialiseComponents: function () {
var a = this;
var dialog = a.getElement();
var btnToggleSize = $(dialog).find("button[data-modal-action='restore']");
if ($(btnToggleSize).length > 0) {
$(btnToggleSize).off('click');
$(btnToggleSize).on('click', function () {
a.toggleSize();
});
}
$(dialog).modal('show');
$(dialog).off('hide.bs.modal');
$(dialog).on('hide.bs.modal', function () {
if ($(dialog).next().is("div[class~='modal-backdrop']")) {
$(dialog).next().remove();
}
$(dialog).remove();
});
},
updateContentBody: function (id, text) {
var body = $("#dlg" + id).find(".modal-body");
if ($(body).hasClass("custom-loading")) $(body).removeClass("custom-loading");
$(body).html(text);
},
getElement: function () {
return $("#dlg" + this.id);
},
toggleSize: function () {
var div = $(this.getElement()).find("div[class^='modal-dialog']");
if ($(div).length <= 0) {
return;
}
if ($(div).hasClass("modal-md")) {
$(div).removeClass("modal-md");
$(div).addClass("modal-lg");
} else if ($(div).hasClass("modal-lg")) {
$(div).removeClass("modal-lg");
$(div).addClass("modal-md");
}
}
};

View File

@ -1,174 +0,0 @@
/**
* BSDialog
* @version v0.1.0.027 (2019/09/19 0002)
*/
var BSDialog = {
Create: function (id, title, url, is_big, update_body) {
var a = this;
a.id = id;
a.title = title;
a.url = url;
a.isBig = ((typeof (is_big) == "undefined") ? false : (is_big == true) ? true : false);
var updateBody = ((typeof (update_body) == "undefined") ? true : (update_body == true) ? true : false);
if (!a.Exists(id)) {
a.renderContent(null);
}
if (url != null) {
$.ajax({
url: url,
cache: false,
timeout: 60000,
success: function (result, status, xhr) {
if ((xhr.status == 200) || (xhr.status == 302) || (xhr.status == 301)) {
if (updateBody) {
a.updateContentBody(id, result);
} else {
$("#dlg" + id).find(".modal-content").html(result);
}
} else {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
}
},
error: function (xhr) {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
},
complete: function (xhr, status) {
// do nothing yet
}
});
}
a.initialiseComponents();
},
Close: function (id) {
$("#dlg" + id).modal('hide');
},
Clear: function () {
$("body > div[class~='modal'][role='dialog']").remove();
$("body > div[class~='modal-backdrop']").remove();
$("body").removeClass("modal-open");
},
ShowToast: function (id, title, message, is_big) {
var a = this;
if (a.Exists(id)) {
return;
}
a.id = id;
a.title = title;
a.url = null;
a.isBig = ((typeof (is_big) == "undefined") ? false : (is_big == true) ? true : false);
a.renderContent(message);
a.initialiseComponents();
},
Exists: function (id) {
return ($("body > div[id='dlg" + id + "']").length > 0);
},
generateModalHtml: function (message) {
var a = this;
var size = ((typeof (a.isBig) == "undefined") ? "md" : (a.isBig == true ? "lg" : "md"));
var html = "";
html += "<div class=\"modal fade\" id=\"dlg" + a.id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"dlg" + a.id + "Label\" aria-hidden=\"true\">";
html += " <div class=\"modal-dialog modal-" + size + "\">";
html += " <div class=\"modal-content\">";
html += " <div class=\"modal-header\">";
html += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>";
html += " <span class=\"close\">&nbsp;</span>";
html += " <button type=\"button\" class=\"close\" data-modal-action=\"restore\" aria-hidden=\"true\">&#8722;</button>";
html += " <strong class=\"modal-title\" style=\"cursor:default; \">" + a.title + "</strong>";
html += " </div>";
if ($.trim(message).length <= 0) {
html += " <div class=\"modal-body custom-loading\"></div>";
} else {
html += " <div class=\"modal-body\">" + message + "</div>";
}
html += " <div class=\"modal-footer\">";
html += " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>";
html += " </div>";
html += " </div>";
html += " </div>";
html += "</div>";
return html;
},
renderContent: function (content) {
$("body").append(this.generateModalHtml(content));
},
initialiseComponents: function () {
var a = this;
var dialog = a.getElement();
var btnToggleSize = $(dialog).find("button[data-modal-action='restore']");
if ($(btnToggleSize).length > 0) {
$(btnToggleSize).off('click');
$(btnToggleSize).on('click', function () {
a.toggleSize();
});
}
$(dialog).modal('show');
$(dialog).off('hide.bs.modal');
$(dialog).on('hide.bs.modal', function () {
if ($(dialog).next().is("div[class~='modal-backdrop']")) {
$(dialog).next().remove();
}
$(dialog).remove();
});
$(dialog).find(".modal-header").off("mousedown");
$(dialog).find(".modal-header").on("mousedown", function(e) {
var posX = e.pageX - $(this).offset().left;
var posY = e.pageY - $(this).offset().top;
$("body").off("mousemove.draggable");
$("body").on("mousemove.draggable", function(e2) {
$(dialog).children(".modal-dialog").offset({ "left": (e2.pageX - posX), "top": (e2.pageY - posY) });
});
$("body").off("mouseup");
$("body").on("mouseup", function() {
$("body").off("mousemove.draggable");
});
$(dialog).off("bs.modal.hide");
$(dialog).on("bs.modal.hide", function() {
$("body").off("mousemove.draggable");
});
});
},
updateContentBody: function (id, text) {
var body = $("#dlg" + id).find(".modal-body");
if ($(body).hasClass("custom-loading")) $(body).removeClass("custom-loading");
$(body).html(text);
},
getElement: function () {
return $("#dlg" + this.id);
},
toggleSize: function () {
var div = $(this.getElement()).find("div[class^='modal-dialog']");
if ($(div).length <= 0) {
return;
}
if ($(div).hasClass("modal-md")) {
$(div).removeClass("modal-md");
$(div).addClass("modal-lg");
} else if ($(div).hasClass("modal-lg")) {
$(div).removeClass("modal-lg");
$(div).addClass("modal-md");
}
}
};

View File

@ -1,5 +0,0 @@
/**
* BSDialog
* @version v0.1.0.027 (2019/09/19 0002)
*/
var BSDialog={Create:function(o,t,d,e,a){var s=this;s.id=o,s.title=t,s.url=d,s.isBig=void 0!==e&&1==e;var l=void 0===a||1==a;s.Exists(o)||s.renderContent(null),null!=d&&$.ajax({url:d,cache:!1,timeout:6e4,success:function(t,d,e){200==e.status||302==e.status||301==e.status?l?s.updateContentBody(o,t):$("#dlg"+o).find(".modal-content").html(t):s.updateContentBody(o,e.statusText+" ("+e.status+")")},error:function(t){s.updateContentBody(o,t.statusText+" ("+t.status+")")},complete:function(o,t){}}),s.initialiseComponents()},Close:function(o){$("#dlg"+o).modal("hide")},Clear:function(){$("body > div[class~='modal'][role='dialog']").remove(),$("body > div[class~='modal-backdrop']").remove(),$("body").removeClass("modal-open")},ShowToast:function(o,t,d,e){var a=this;a.Exists(o)||(a.id=o,a.title=t,a.url=null,a.isBig=void 0!==e&&1==e,a.renderContent(d),a.initialiseComponents())},Exists:function(o){return $("body > div[id='dlg"+o+"']").length>0},generateModalHtml:function(o){var t=this,d=void 0===t.isBig?"md":1==t.isBig?"lg":"md",e="";return e+='<div class="modal fade" id="dlg'+t.id+'" tabindex="-1" role="dialog" aria-labelledby="dlg'+t.id+'Label" aria-hidden="true">',e+=' <div class="modal-dialog modal-'+d+'">',e+=' <div class="modal-content">',e+=' <div class="modal-header">',e+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>',e+=' <span class="close">&nbsp;</span>',e+=' <button type="button" class="close" data-modal-action="restore" aria-hidden="true">&#8722;</button>',e+=' <strong class="modal-title" style="cursor:default; ">'+t.title+"</strong>",e+=" </div>",$.trim(o).length<=0?e+=' <div class="modal-body custom-loading"></div>':e+=' <div class="modal-body">'+o+"</div>",e+=' <div class="modal-footer">',e+=' <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>',e+=" </div>",e+=" </div>",e+=" </div>",e+="</div>"},renderContent:function(o){$("body").append(this.generateModalHtml(o))},initialiseComponents:function(){var o=this,t=o.getElement(),d=$(t).find("button[data-modal-action='restore']");$(d).length>0&&($(d).off("click"),$(d).on("click",function(){o.toggleSize()})),$(t).modal("show"),$(t).off("hide.bs.modal"),$(t).on("hide.bs.modal",function(){$(t).next().is("div[class~='modal-backdrop']")&&$(t).next().remove(),$(t).remove()}),$(t).find(".modal-header").off("mousedown"),$(t).find(".modal-header").on("mousedown",function(o){var d=o.pageX-$(this).offset().left,e=o.pageY-$(this).offset().top;$("body").off("mousemove.draggable"),$("body").on("mousemove.draggable",function(o){$(t).children(".modal-dialog").offset({left:o.pageX-d,top:o.pageY-e})}),$("body").off("mouseup"),$("body").on("mouseup",function(){$("body").off("mousemove.draggable")}),$(t).off("bs.modal.hide"),$(t).on("bs.modal.hide",function(){$("body").off("mousemove.draggable")})})},updateContentBody:function(o,t){var d=$("#dlg"+o).find(".modal-body");$(d).hasClass("custom-loading")&&$(d).removeClass("custom-loading"),$(d).html(t)},getElement:function(){return $("#dlg"+this.id)},toggleSize:function(){var o=$(this.getElement()).find("div[class^='modal-dialog']");$(o).length<=0||($(o).hasClass("modal-md")?($(o).removeClass("modal-md"),$(o).addClass("modal-lg")):$(o).hasClass("modal-lg")&&($(o).removeClass("modal-lg"),$(o).addClass("modal-md")))}};

View File

@ -1,183 +0,0 @@
/**
* BSDialog
* @version v0.1.0.029 (2019/09/24 1112)
*/
var BSDialog = {
Create: function (id, title, url, is_big, update_body, show_size) {
var a = this;
a.id = id;
a.title = title;
a.url = url;
a.isBig = ((typeof (is_big) == "undefined") ? false : (is_big == true) ? true : false);
a.showSize = ((typeof (show_size) == "undefined") ? true : (show_size == true) ? true : false);
var updateBody = ((typeof (update_body) == "undefined") ? true : (update_body == true) ? true : false);
if (!a.Exists(id)) {
a.renderContent(null);
}
if (url != null) {
$.ajax({
url: url,
cache: false,
timeout: 60000,
success: function (result, status, xhr) {
if ((xhr.status == 200) || (xhr.status == 302) || (xhr.status == 301)) {
if (updateBody) {
a.updateContentBody(id, result);
} else {
$("#dlg" + id).find(".modal-content").html(result);
}
} else {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
}
},
error: function (xhr) {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
},
complete: function (xhr, status) {
// do nothing yet
}
});
}
a.initialiseComponents();
},
Close: function (id) {
$("#dlg" + id).modal('hide');
},
Clear: function () {
$("body > div[class~='modal'][role='dialog']").remove();
$("body > div[class~='modal-backdrop']").remove();
$("body").removeClass("modal-open");
},
ShowToast: function (id, title, message, is_big) {
var a = this;
if (a.Exists(id)) {
return;
}
a.id = id;
a.title = title;
a.url = null;
a.isBig = ((typeof (is_big) == "undefined") ? false : (is_big == true) ? true : false);
a.renderContent(message);
a.initialiseComponents();
},
Exists: function (id) {
return ($("body > div[id='dlg" + id + "']").length > 0);
},
generateModalHtml: function (message) {
var a = this;
var size = (a.isBig == true ? "lg" : "md");
var html = "";
html += "<div class=\"modal fade\" id=\"dlg" + a.id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"dlg" + a.id + "Label\" aria-hidden=\"true\">";
html += " <div class=\"modal-dialog modal-" + size + "\">";
html += " <div class=\"modal-content\">";
html += " <div class=\"modal-header\">";
html += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>";
if (a.showSize)
{
html += " <span class=\"close\">&nbsp;</span>";
html += " <button type=\"button\" class=\"close\" data-modal-action=\"restore\" aria-hidden=\"true\">&#8722;</button>";
}
html += " <strong class=\"modal-title\" style=\"cursor:default; \">" + a.title + "</strong>";
html += " </div>";
if ($.trim(message).length <= 0) {
html += " <div class=\"modal-body custom-loading\" style=\"background-position: center center; background-repeat: no-repeat;\"></div>";
} else {
html += " <div class=\"modal-body\">" + message + "</div>";
}
html += " <div class=\"modal-footer\">";
html += " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>";
html += " </div>";
html += " </div>";
html += " </div>";
html += "</div>";
return html;
},
renderContent: function (content) {
$("body").append(this.generateModalHtml(content));
},
initialiseComponents: function () {
var a = this;
var dialog = a.getElement();
if (a.showSize)
{
var btnToggleSize = $(dialog).find("button[data-modal-action='restore']");
if ($(btnToggleSize).length > 0) {
$(btnToggleSize).off('click');
$(btnToggleSize).on('click', function () {
a.toggleSize();
});
}
}
$(dialog).modal('show');
$(dialog).off('hide.bs.modal');
$(dialog).on('hide.bs.modal', function () {
if ($(dialog).next().is("div[class~='modal-backdrop']")) {
$(dialog).next().remove();
}
$(dialog).remove();
});
$(dialog).find(".modal-header").off("mousedown");
$(dialog).find(".modal-header").on("mousedown", function(e) {
var posX = e.pageX - $(this).offset().left;
var posY = e.pageY - $(this).offset().top;
$("body").off("mousemove.draggable");
$("body").on("mousemove.draggable", function(e2) {
$(dialog).children(".modal-dialog").offset({ "left": (e2.pageX - posX), "top": (e2.pageY - posY) });
});
$("body").off("mouseup");
$("body").on("mouseup", function() {
$("body").off("mousemove.draggable");
});
$(dialog).off("bs.modal.hide");
$(dialog).on("bs.modal.hide", function() {
$("body").off("mousemove.draggable");
});
});
},
updateContentBody: function (id, text) {
var body = $("#dlg" + id).find(".modal-body");
if ($(body).hasClass("custom-loading")) $(body).removeClass("custom-loading");
$(body).html(text);
},
getElement: function () {
return $("#dlg" + this.id);
},
toggleSize: function () {
var div = $(this.getElement()).find("div[class^='modal-dialog']");
if ($(div).length <= 0) {
return;
}
if ($(div).hasClass("modal-md")) {
$(div).removeClass("modal-md");
$(div).addClass("modal-lg");
} else if ($(div).hasClass("modal-lg")) {
$(div).removeClass("modal-lg");
$(div).addClass("modal-md");
}
}
};

View File

@ -1,5 +0,0 @@
/**
* BSDialog
* @version v0.1.0.029 (2019/09/24 1112)
*/
var BSDialog={Create:function(d,o,t,e,a,s){var l=this;l.id=d,l.title=o,l.url=t,l.isBig=void 0!==e&&1==e,l.showSize=void 0===s||1==s;var n=void 0===a||1==a;l.Exists(d)||l.renderContent(null),null!=t&&$.ajax({url:t,cache:!1,timeout:6e4,success:function(o,t,e){200==e.status||302==e.status||301==e.status?n?l.updateContentBody(d,o):$("#dlg"+d).find(".modal-content").html(o):l.updateContentBody(d,e.statusText+" ("+e.status+")")},error:function(o){l.updateContentBody(d,o.statusText+" ("+o.status+")")},complete:function(o,t){}}),l.initialiseComponents()},Close:function(o){$("#dlg"+o).modal("hide")},Clear:function(){$("body > div[class~='modal'][role='dialog']").remove(),$("body > div[class~='modal-backdrop']").remove(),$("body").removeClass("modal-open")},ShowToast:function(o,t,e,d){var a=this;a.Exists(o)||(a.id=o,a.title=t,a.url=null,a.isBig=void 0!==d&&1==d,a.renderContent(e),a.initialiseComponents())},Exists:function(o){return 0<$("body > div[id='dlg"+o+"']").length},generateModalHtml:function(o){var t=this,e=1==t.isBig?"lg":"md",d="";return d+='<div class="modal fade" id="dlg'+t.id+'" tabindex="-1" role="dialog" aria-labelledby="dlg'+t.id+'Label" aria-hidden="true">',d+=' <div class="modal-dialog modal-'+e+'">',d+=' <div class="modal-content">',d+=' <div class="modal-header">',d+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>',t.showSize&&(d+=' <span class="close">&nbsp;</span>',d+=' <button type="button" class="close" data-modal-action="restore" aria-hidden="true">&#8722;</button>'),d+=' <strong class="modal-title" style="cursor:default; ">'+t.title+"</strong>",d+=" </div>",$.trim(o).length<=0?d+=' <div class="modal-body custom-loading" style="background-position: center center; background-repeat: no-repeat;"></div>':d+=' <div class="modal-body">'+o+"</div>",d+=' <div class="modal-footer">',d+=' <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>',d+=" </div>",d+=" </div>",d+=" </div>",d+="</div>"},renderContent:function(o){$("body").append(this.generateModalHtml(o))},initialiseComponents:function(){var o=this,d=o.getElement();if(o.showSize){var t=$(d).find("button[data-modal-action='restore']");0<$(t).length&&($(t).off("click"),$(t).on("click",function(){o.toggleSize()}))}$(d).modal("show"),$(d).off("hide.bs.modal"),$(d).on("hide.bs.modal",function(){$(d).next().is("div[class~='modal-backdrop']")&&$(d).next().remove(),$(d).remove()}),$(d).find(".modal-header").off("mousedown"),$(d).find(".modal-header").on("mousedown",function(o){var t=o.pageX-$(this).offset().left,e=o.pageY-$(this).offset().top;$("body").off("mousemove.draggable"),$("body").on("mousemove.draggable",function(o){$(d).children(".modal-dialog").offset({left:o.pageX-t,top:o.pageY-e})}),$("body").off("mouseup"),$("body").on("mouseup",function(){$("body").off("mousemove.draggable")}),$(d).off("bs.modal.hide"),$(d).on("bs.modal.hide",function(){$("body").off("mousemove.draggable")})})},updateContentBody:function(o,t){var e=$("#dlg"+o).find(".modal-body");$(e).hasClass("custom-loading")&&$(e).removeClass("custom-loading"),$(e).html(t)},getElement:function(){return $("#dlg"+this.id)},toggleSize:function(){var o=$(this.getElement()).find("div[class^='modal-dialog']");$(o).length<=0||($(o).hasClass("modal-md")?($(o).removeClass("modal-md"),$(o).addClass("modal-lg")):$(o).hasClass("modal-lg")&&($(o).removeClass("modal-lg"),$(o).addClass("modal-md")))}};

BIN
2019/10/280-150x140.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
2019/10/280.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
2019/10/297-150x140.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
2019/10/297.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -1,186 +0,0 @@
/**
* BSDialog
* @version v0.1.0.029a (2019/11/09 2239)
*/
var BSDialog = {
Create: function (id, title, url, is_big, update_body, show_size) {
var a = this;
a.id = id;
a.title = title;
a.url = url;
a.isBig = ((typeof (is_big) == "undefined") ? false : (is_big == true) ? true : false);
a.showSize = ((typeof (show_size) == "undefined") ? true : (show_size == true) ? true : false);
var updateBody = ((typeof (update_body) == "undefined") ? true : (update_body == true) ? true : false);
if (!a.Exists(id)) {
a.renderContent(null);
}
if (url != null) {
$.ajax({
url: url,
cache: false,
xhrFields: {
withCredentials:true
},
timeout: 60000,
success: function (result, status, xhr) {
if ((xhr.status == 200) || (xhr.status == 302) || (xhr.status == 301)) {
if (updateBody) {
a.updateContentBody(id, result);
} else {
$("#dlg" + id).find(".modal-content").html(result);
}
} else {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
}
},
error: function (xhr) {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
},
complete: function (xhr, status) {
// do nothing yet
}
});
}
a.initialiseComponents();
},
Close: function (id) {
$("#dlg" + id).modal('hide');
},
Clear: function () {
$("body > div[class~='modal'][role='dialog']").remove();
$("body > div[class~='modal-backdrop']").remove();
$("body").removeClass("modal-open");
},
ShowToast: function (id, title, message, is_big) {
var a = this;
if (a.Exists(id)) {
return;
}
a.id = id;
a.title = title;
a.url = null;
a.isBig = ((typeof (is_big) == "undefined") ? false : (is_big == true) ? true : false);
a.renderContent(message);
a.initialiseComponents();
},
Exists: function (id) {
return ($("body > div[id='dlg" + id + "']").length > 0);
},
generateModalHtml: function (message) {
var a = this;
var size = (a.isBig == true ? "lg" : "md");
var html = "";
html += "<div class=\"modal fade\" id=\"dlg" + a.id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"dlg" + a.id + "Label\" aria-hidden=\"true\">";
html += " <div class=\"modal-dialog modal-" + size + "\">";
html += " <div class=\"modal-content\">";
html += " <div class=\"modal-header\">";
html += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>";
if (a.showSize)
{
html += " <span class=\"close\">&nbsp;</span>";
html += " <button type=\"button\" class=\"close\" data-modal-action=\"restore\" aria-hidden=\"true\">&#8722;</button>";
}
html += " <strong class=\"modal-title\" style=\"cursor:default; \">" + a.title + "</strong>";
html += " </div>";
if ($.trim(message).length <= 0) {
html += " <div class=\"modal-body custom-loading\" style=\"background-position: center center; background-repeat: no-repeat;\"></div>";
} else {
html += " <div class=\"modal-body\">" + message + "</div>";
}
html += " <div class=\"modal-footer\">";
html += " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>";
html += " </div>";
html += " </div>";
html += " </div>";
html += "</div>";
return html;
},
renderContent: function (content) {
$("body").append(this.generateModalHtml(content));
},
initialiseComponents: function () {
var a = this;
var dialog = a.getElement();
if (a.showSize)
{
var btnToggleSize = $(dialog).find("button[data-modal-action='restore']");
if ($(btnToggleSize).length > 0) {
$(btnToggleSize).off('click');
$(btnToggleSize).on('click', function () {
a.toggleSize();
});
}
}
$(dialog).modal('show');
$(dialog).off('hide.bs.modal');
$(dialog).on('hide.bs.modal', function () {
if ($(dialog).next().is("div[class~='modal-backdrop']")) {
$(dialog).next().remove();
}
$(dialog).remove();
});
$(dialog).find(".modal-header").off("mousedown");
$(dialog).find(".modal-header").on("mousedown", function(e) {
var posX = e.pageX - $(this).offset().left;
var posY = e.pageY - $(this).offset().top;
$("body").off("mousemove.draggable");
$("body").on("mousemove.draggable", function(e2) {
$(dialog).children(".modal-dialog").offset({ "left": (e2.pageX - posX), "top": (e2.pageY - posY) });
});
$("body").off("mouseup");
$("body").on("mouseup", function() {
$("body").off("mousemove.draggable");
});
$(dialog).off("bs.modal.hide");
$(dialog).on("bs.modal.hide", function() {
$("body").off("mousemove.draggable");
});
});
},
updateContentBody: function (id, text) {
var body = $("#dlg" + id).find(".modal-body");
if ($(body).hasClass("custom-loading")) $(body).removeClass("custom-loading");
$(body).html(text);
},
getElement: function () {
return $("#dlg" + this.id);
},
toggleSize: function () {
var div = $(this.getElement()).find("div[class^='modal-dialog']");
if ($(div).length <= 0) {
return;
}
if ($(div).hasClass("modal-md")) {
$(div).removeClass("modal-md");
$(div).addClass("modal-lg");
} else if ($(div).hasClass("modal-lg")) {
$(div).removeClass("modal-lg");
$(div).addClass("modal-md");
}
}
};

View File

@ -1,5 +0,0 @@
/**
* BSDialog
* @version v0.1.0.029a (2019/11/09 2239)
*/
var BSDialog={Create:function(o,t,e,d,a,s){var l=this;l.id=o,l.title=t,l.url=e,l.isBig=void 0!==d&&1==d,l.showSize=void 0===s||1==s;var n=void 0===a||1==a;l.Exists(o)||l.renderContent(null),null!=e&&$.ajax({url:e,cache:!1,xhrFields:{withCredentials:!0},timeout:6e4,success:function(t,e,d){200==d.status||302==d.status||301==d.status?n?l.updateContentBody(o,t):$("#dlg"+o).find(".modal-content").html(t):l.updateContentBody(o,d.statusText+" ("+d.status+")")},error:function(t){l.updateContentBody(o,t.statusText+" ("+t.status+")")},complete:function(o,t){}}),l.initialiseComponents()},Close:function(o){$("#dlg"+o).modal("hide")},Clear:function(){$("body > div[class~='modal'][role='dialog']").remove(),$("body > div[class~='modal-backdrop']").remove(),$("body").removeClass("modal-open")},ShowToast:function(o,t,e,d){var a=this;a.Exists(o)||(a.id=o,a.title=t,a.url=null,a.isBig=void 0!==d&&1==d,a.renderContent(e),a.initialiseComponents())},Exists:function(o){return $("body > div[id='dlg"+o+"']").length>0},generateModalHtml:function(o){var t=this,e=1==t.isBig?"lg":"md",d="";return d+='<div class="modal fade" id="dlg'+t.id+'" tabindex="-1" role="dialog" aria-labelledby="dlg'+t.id+'Label" aria-hidden="true">',d+=' <div class="modal-dialog modal-'+e+'">',d+=' <div class="modal-content">',d+=' <div class="modal-header">',d+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>',t.showSize&&(d+=' <span class="close">&nbsp;</span>',d+=' <button type="button" class="close" data-modal-action="restore" aria-hidden="true">&#8722;</button>'),d+=' <strong class="modal-title" style="cursor:default; ">'+t.title+"</strong>",d+=" </div>",$.trim(o).length<=0?d+=' <div class="modal-body custom-loading" style="background-position: center center; background-repeat: no-repeat;"></div>':d+=' <div class="modal-body">'+o+"</div>",d+=' <div class="modal-footer">',d+=' <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>',d+=" </div>",d+=" </div>",d+=" </div>",d+="</div>"},renderContent:function(o){$("body").append(this.generateModalHtml(o))},initialiseComponents:function(){var o=this,t=o.getElement();if(o.showSize){var e=$(t).find("button[data-modal-action='restore']");$(e).length>0&&($(e).off("click"),$(e).on("click",function(){o.toggleSize()}))}$(t).modal("show"),$(t).off("hide.bs.modal"),$(t).on("hide.bs.modal",function(){$(t).next().is("div[class~='modal-backdrop']")&&$(t).next().remove(),$(t).remove()}),$(t).find(".modal-header").off("mousedown"),$(t).find(".modal-header").on("mousedown",function(o){var e=o.pageX-$(this).offset().left,d=o.pageY-$(this).offset().top;$("body").off("mousemove.draggable"),$("body").on("mousemove.draggable",function(o){$(t).children(".modal-dialog").offset({left:o.pageX-e,top:o.pageY-d})}),$("body").off("mouseup"),$("body").on("mouseup",function(){$("body").off("mousemove.draggable")}),$(t).off("bs.modal.hide"),$(t).on("bs.modal.hide",function(){$("body").off("mousemove.draggable")})})},updateContentBody:function(o,t){var e=$("#dlg"+o).find(".modal-body");$(e).hasClass("custom-loading")&&$(e).removeClass("custom-loading"),$(e).html(t)},getElement:function(){return $("#dlg"+this.id)},toggleSize:function(){var o=$(this.getElement()).find("div[class^='modal-dialog']");$(o).length<=0||($(o).hasClass("modal-md")?($(o).removeClass("modal-md"),$(o).addClass("modal-lg")):$(o).hasClass("modal-lg")&&($(o).removeClass("modal-lg"),$(o).addClass("modal-md")))}};

View File

@ -1,182 +0,0 @@
/**
* BSDialog4
* @version v0.1.0.001 (2019/12/27 0531)
*/
var BSDialog = {
Create: function (id, title, url, size) {
var a = this;
a.id = id;
a.title = title;
a.url = url;
a.size = ((typeof (size) == "undefined") ? "md" : size);
if (!a.Exists(id)) {
a.renderContent(null);
}
if (url != null) {
$.ajax({
url: url,
cache: false,
xhrFields: {
withCredentials:true
},
timeout: 20000,
success: function (result, status, xhr) {
if ((xhr.status == 200) || (xhr.status == 302) || (xhr.status == 301)) {
a.updateContentBody(id, result);
} else {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
}
},
error: function (xhr) {
a.updateContentBody(id, xhr.statusText + " (" + xhr.status + ")");
},
complete: function (xhr, status) {
// do nothing yet
}
});
}
a.initialiseComponents();
},
Close: function (id) {
$("#dlg" + id).modal('hide');
},
Clear: function () {
$("body > div[class~='modal'][role='dialog']").remove();
$("body > div[class~='modal-backdrop']").remove();
$("body").removeClass("modal-open");
},
ShowToast: function (id, title, message, size) {
var a = this;
if (a.Exists(id)) {
return;
}
a.id = id;
a.title = title;
a.url = null;
a.size = ((typeof (size) == "undefined") ? "md" : size);
a.renderContent(message);
a.initialiseComponents();
},
Exists: function (id) {
return ($("body > div[id='dlg" + id + "']").length > 0);
},
generateModalHtml: function (message) {
var a = this;
var html = "";
html += "<div class=\"modal fade\" id=\"dlg" + a.id + "\" tabindex=\"-1\" role=\"dialog\">";
html += " <div class=\"modal-dialog modal-" + a.size + "\">";
html += " <div class=\"modal-content\">";
html += " <div class=\"modal-header\">";
html += " <strong class=\"modal-title\" style=\"cursor:default; \">" + a.title + "</strong>";
html += " <button type=\"button\" class=\"close\" data-modal-action=\"restore\" aria-hidden=\"true\">&#8722;</button>";
html += " <button type=\"button\" class=\"close ml-0\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>";
html += " </div>";
if ($.trim(message).length <= 0) {
html += " <div class=\"modal-body\">";
html += " <div class=\"text-center\">";
html += " <div class=\"spinner-border text-secondary text-center\" role=\"status\">";
html += " <span class=\"sr-only\">Loading...</span>";
html += " </div>";
html += " </div>";
html += " </div>";
} else {
html += " <div class=\"modal-body\">" + message + "</div>";
}
html += " <div class=\"modal-footer\">";
html += " <button type=\"button\" class=\"btn btn-outline-dark\" data-dismiss=\"modal\">Close</button>";
html += " </div>";
html += " </div>";
html += " </div>";
html += "</div>";
return html;
},
renderContent: function (content) {
$("body").append(this.generateModalHtml(content));
},
initialiseComponents: function () {
var a = this;
var dialog = a.getElement();
var btnToggleSize = $(dialog).find("button[data-modal-action='restore']");
if ($(btnToggleSize).length > 0) {
$(btnToggleSize).off('click');
$(btnToggleSize).on('click', function () {
a.toggleSize();
});
}
$(dialog).modal('show');
$(dialog).off('hide.bs.modal');
$(dialog).on('hide.bs.modal', function () {
if ($(dialog).next().is("div[class~='modal-backdrop']")) {
$(dialog).next().remove();
}
$(dialog).remove();
});
$(dialog).find(".modal-header").off("mousedown");
$(dialog).find(".modal-header").on("mousedown", function(e) {
var posX = e.pageX - $(this).offset().left;
var posY = e.pageY - $(this).offset().top;
$("body").off("mousemove.draggable");
$("body").on("mousemove.draggable", function(e2) {
$(dialog).children(".modal-dialog").offset({ "left": (e2.pageX - posX), "top": (e2.pageY - posY) });
});
$("body").off("mouseup");
$("body").on("mouseup", function() {
$("body").off("mousemove.draggable");
});
$(dialog).off("bs.modal.hide");
$(dialog).on("bs.modal.hide", function() {
$("body").off("mousemove.draggable");
});
});
},
updateContentBody: function (id, text) {
var body = $("#dlg" + id).find(".modal-body");
if ($(body).hasClass("custom-loading")) $(body).removeClass("custom-loading");
$(body).html(text);
},
getElement: function () {
return $("#dlg" + this.id);
},
toggleSize: function () {
var div = $(this.getElement()).find("div[class^='modal-dialog']");
if ($(div).length <= 0) {
return;
}
if ($(div).hasClass("modal-md")) {
$(div).removeClass("modal-md");
$(div).addClass("modal-lg");
} else if ($(div).hasClass("modal-lg")) {
$(div).removeClass("modal-lg");
$(div).addClass("modal-xl");
} else if ($(div).hasClass("modal-xl")) {
$(div).removeClass("modal-xl");
$(div).addClass("modal-sm");
} else if ($(div).hasClass("modal-sm")) {
$(div).removeClass("modal-sm");
$(div).addClass("modal-md");
}
}
};

View File

@ -1,5 +0,0 @@
/**
* BSDialog4
* @version v0.1.0.001 (2019/12/27 0531)
*/
var BSDialog={Create:function(o,t,e,d){var a=this;a.id=o,a.title=t,a.url=e,a.size=void 0===d?"md":d,a.Exists(o)||a.renderContent(null),null!=e&&$.ajax({url:e,cache:!1,xhrFields:{withCredentials:!0},timeout:2e4,success:function(t,e,d){200==d.status||302==d.status||301==d.status?a.updateContentBody(o,t):a.updateContentBody(o,d.statusText+" ("+d.status+")")},error:function(t){a.updateContentBody(o,t.statusText+" ("+t.status+")")},complete:function(o,t){}}),a.initialiseComponents()},Close:function(o){$("#dlg"+o).modal("hide")},Clear:function(){$("body > div[class~='modal'][role='dialog']").remove(),$("body > div[class~='modal-backdrop']").remove(),$("body").removeClass("modal-open")},ShowToast:function(o,t,e,d){var a=this;a.Exists(o)||(a.id=o,a.title=t,a.url=null,a.size=void 0===d?"md":d,a.renderContent(e),a.initialiseComponents())},Exists:function(o){return $("body > div[id='dlg"+o+"']").length>0},generateModalHtml:function(o){var t=this,e="";return e+='<div class="modal fade" id="dlg'+t.id+'" tabindex="-1" role="dialog">',e+=' <div class="modal-dialog modal-'+t.size+'">',e+=' <div class="modal-content">',e+=' <div class="modal-header">',e+=' <strong class="modal-title" style="cursor:default; ">'+t.title+"</strong>",e+=' <button type="button" class="close" data-modal-action="restore" aria-hidden="true">&#8722;</button>',e+=' <button type="button" class="close ml-0" data-dismiss="modal" aria-hidden="true">&times;</button>',e+=" </div>",$.trim(o).length<=0?(e+=' <div class="modal-body">',e+=' <div class="text-center">',e+=' <div class="spinner-border text-secondary text-center" role="status">',e+=' <span class="sr-only">Loading...</span>',e+=" </div>",e+=" </div>",e+=" </div>"):e+=' <div class="modal-body">'+o+"</div>",e+=' <div class="modal-footer">',e+=' <button type="button" class="btn btn-outline-dark" data-dismiss="modal">Close</button>',e+=" </div>",e+=" </div>",e+=" </div>",e+="</div>"},renderContent:function(o){$("body").append(this.generateModalHtml(o))},initialiseComponents:function(){var o=this,t=o.getElement(),e=$(t).find("button[data-modal-action='restore']");$(e).length>0&&($(e).off("click"),$(e).on("click",function(){o.toggleSize()})),$(t).modal("show"),$(t).off("hide.bs.modal"),$(t).on("hide.bs.modal",function(){$(t).next().is("div[class~='modal-backdrop']")&&$(t).next().remove(),$(t).remove()}),$(t).find(".modal-header").off("mousedown"),$(t).find(".modal-header").on("mousedown",function(o){var e=o.pageX-$(this).offset().left,d=o.pageY-$(this).offset().top;$("body").off("mousemove.draggable"),$("body").on("mousemove.draggable",function(o){$(t).children(".modal-dialog").offset({left:o.pageX-e,top:o.pageY-d})}),$("body").off("mouseup"),$("body").on("mouseup",function(){$("body").off("mousemove.draggable")}),$(t).off("bs.modal.hide"),$(t).on("bs.modal.hide",function(){$("body").off("mousemove.draggable")})})},updateContentBody:function(o,t){var e=$("#dlg"+o).find(".modal-body");$(e).hasClass("custom-loading")&&$(e).removeClass("custom-loading"),$(e).html(t)},getElement:function(){return $("#dlg"+this.id)},toggleSize:function(){var o=$(this.getElement()).find("div[class^='modal-dialog']");$(o).length<=0||($(o).hasClass("modal-md")?($(o).removeClass("modal-md"),$(o).addClass("modal-lg")):$(o).hasClass("modal-lg")?($(o).removeClass("modal-lg"),$(o).addClass("modal-xl")):$(o).hasClass("modal-xl")?($(o).removeClass("modal-xl"),$(o).addClass("modal-sm")):$(o).hasClass("modal-sm")&&($(o).removeClass("modal-sm"),$(o).addClass("modal-md")))}};

BIN
2020/02/426-150x140.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
2020/02/426.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
2020/02/450-150x140.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
2020/02/450.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
2020/02/diff-image-diff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,79 +0,0 @@
.switch {
display: inline-block;
height: 30px;
position: relative;
width: 56px;
}
.switch > input {
height: 0px;
opacity: 0;
width: 0px;
}
.switch > .switch-slider {
-webkit-transition: .4s;
background-color: #ccc;
border-radius: 30px;
bottom: 0;
cursor: pointer;
left: 0;
position: absolute;
right: 0;
top: 0;
transition: .4s;
}
.switch > .switch-slider:before {
-webkit-transition: .4s;
background-color: white;
border-radius: 50%;
bottom: 4px;
content: "";
height: 22px;
left: 4px;
position: absolute;
transition: .4s;
width: 22px;
}
.switch > input:checked + .switch-slider:before {
-ms-transform: translateX(26px);
-webkit-transform: translateX(26px);
transform: translateX(26px);
}
.switch.switch-off-primary > input + .switch-slider { background-color: #2196F3; }
.switch.switch-off-success > input + .switch-slider { background-color: #5cb85c; }
.switch.switch-off-info > input + .switch-slider { background-color: #5bc0de; }
.switch.switch-off-warning > input + .switch-slider { background-color: #f0ad4e; }
.switch.switch-off-danger > input + .switch-slider { background-color: #d9534f; }
.switch.switch-off-muted > input + .switch-slider { background-color: #555555; }
.switch.switch-primary > input:checked + .switch-slider { background-color: #2196F3; box-shadow: 0 0 3px #2196F3; }
.switch.switch-success > input:checked + .switch-slider { background-color: #5cb85c; box-shadow: 0 0 3px #5cb85c; }
.switch.switch-info > input:checked + .switch-slider { background-color: #5bc0de; box-shadow: 0 0 3px #5bc0de; }
.switch.switch-warning > input:checked + .switch-slider { background-color: #f0ad4e; box-shadow: 0 0 3px #f0ad4e; }
.switch.switch-danger > input:checked + .switch-slider { background-color: #d9534f; box-shadow: 0 0 3px #d9534f; }
.switch.switch-muted > input:checked + .switch-slider { background-color: #555555; box-shadow: 0 0 3px #555555; }
.switch-label, .label-switch {
float: left;
font-weight: bold;
padding-top: 5px;
}
.switch-sm {
height: 26px;
width: 48px;
}
.switch-sm > .switch-slider:before {
height: 18px;
width: 18px;
}
.switch-sm > input:checked + .switch-slider:before {
-ms-transform: translateX(22px);
-webkit-transform: translateX(22px);
transform: translateX(22px);
}

BIN
2020/04/493-150x140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
2020/04/493.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
2020/11/2020-11-28-0541.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
2020/11/666-150x140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
2020/11/666.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,274 +0,0 @@
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public class BorderlessForm : Form
{
protected bool isDragging = false;
protected Rectangle lastRectangle = new Rectangle();
public BorderlessForm() : base()
{
this.FormBorderStyle = FormBorderStyle.None;
initialiseFormEdge();
}
protected void initialiseFormEdge()
{
int resizeWidth = 5;
this.MouseDown += new MouseEventHandler(form_MouseDown);
this.MouseMove += new MouseEventHandler(form_MouseMove);
this.MouseUp += delegate (object sender, MouseEventArgs e)
{
isDragging = false;
};
// bottom
UserControl uc1 = new UserControl()
{
Anchor = (AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right),
Height = resizeWidth,
Width = this.DisplayRectangle.Width - (resizeWidth * 2),
Left = resizeWidth,
Top = this.DisplayRectangle.Height - resizeWidth,
BackColor = Color.Transparent,
Cursor = Cursors.SizeNS
};
uc1.MouseDown += form_MouseDown;
uc1.MouseUp += form_MouseUp;
uc1.MouseMove += delegate (object sender, MouseEventArgs e)
{
if (isDragging)
{
this.Size = new Size(lastRectangle.Width, e.Y - lastRectangle.Y + this.Height);
}
};
uc1.BringToFront();
this.Controls.Add(uc1);
// right
UserControl uc2 = new UserControl()
{
Anchor = (AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom),
Height = this.DisplayRectangle.Height - (resizeWidth * 2),
Width = resizeWidth,
Left = this.DisplayRectangle.Width - resizeWidth,
Top = resizeWidth,
BackColor = Color.Transparent,
Cursor = Cursors.SizeWE
};
uc2.MouseDown += form_MouseDown;
uc2.MouseUp += form_MouseUp;
uc2.MouseMove += delegate (object sender, MouseEventArgs e)
{
if (isDragging)
{
this.Size = new Size(e.X - lastRectangle.X + this.Width, lastRectangle.Height);
}
};
uc2.BringToFront();
this.Controls.Add(uc2);
// bottom-right
UserControl uc3 = new UserControl()
{
Anchor = (AnchorStyles.Bottom | AnchorStyles.Right),
Height = resizeWidth,
Width = resizeWidth,
Left = this.DisplayRectangle.Width - resizeWidth,
Top = this.DisplayRectangle.Height - resizeWidth,
BackColor = Color.Transparent,
Cursor = Cursors.SizeNWSE
};
uc3.MouseDown += form_MouseDown;
uc3.MouseUp += form_MouseUp;
uc3.MouseMove += delegate (object sender, MouseEventArgs e)
{
if (isDragging)
{
this.Size = new Size((e.X - lastRectangle.X + this.Width), (e.Y - lastRectangle.Y + this.Height));
}
};
uc3.BringToFront();
this.Controls.Add(uc3);
// top-right
UserControl uc4 = new UserControl()
{
Anchor = (AnchorStyles.Top | AnchorStyles.Right),
Height = resizeWidth,
Width = resizeWidth,
Left = this.DisplayRectangle.Width - resizeWidth,
Top = 0,
BackColor = Color.Transparent,
Cursor = Cursors.SizeNESW
};
uc4.MouseDown += form_MouseDown;
uc4.MouseUp += form_MouseUp;
uc4.MouseMove += delegate (object sender, MouseEventArgs e)
{
if (isDragging)
{
int diff = (e.Location.Y - lastRectangle.Y);
int y = (this.Location.Y + diff);
this.Location = new Point(this.Location.X, y);
this.Size = new Size(e.X - lastRectangle.X + this.Width, (this.Height + (diff * -1)));
}
};
uc4.BringToFront();
//uc4.BackColor = Color.Firebrick;
this.Controls.Add(uc4);
// top
UserControl uc5 = new UserControl()
{
Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right),
Height = resizeWidth,
Width = this.DisplayRectangle.Width - (resizeWidth * 2),
Left = resizeWidth,
Top = 0,
BackColor = Color.Transparent,
Cursor = Cursors.SizeNS
};
uc5.MouseDown += form_MouseDown;
uc5.MouseUp += form_MouseUp;
uc5.MouseMove += delegate (object sender, MouseEventArgs e)
{
if (isDragging)
{
int diff = (e.Location.Y - lastRectangle.Y);
int y = (this.Location.Y + diff);
this.Location = new Point(this.Location.X, y);
this.Size = new Size(lastRectangle.Width, (this.Height + (diff * -1)));
}
};
uc5.BringToFront();
this.Controls.Add(uc5);
// left
UserControl uc6 = new UserControl()
{
Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom),
Height = this.DisplayRectangle.Height - (resizeWidth * 2),
Width = resizeWidth,
Left = 0,
Top = resizeWidth,
BackColor = Color.Transparent,
Cursor = Cursors.SizeWE
};
uc6.MouseDown += form_MouseDown;
uc6.MouseUp += form_MouseUp;
uc6.MouseMove += delegate (object sender, MouseEventArgs e)
{
if (isDragging)
{
int diff = (e.Location.X - lastRectangle.X);
int x = (this.Location.X + diff);
this.Location = new Point(x, this.Location.Y);
this.Size = new Size((this.Width + (diff * -1)), this.Height);
}
};
uc6.BringToFront();
this.Controls.Add(uc6);
// bottom-left
UserControl uc7 = new UserControl()
{
Anchor = (AnchorStyles.Bottom | AnchorStyles.Left),
Height = resizeWidth,
Width = resizeWidth,
Left = 0,
Top = this.DisplayRectangle.Height - resizeWidth,
BackColor = Color.Transparent,
Cursor = Cursors.SizeNESW
};
uc7.MouseDown += form_MouseDown;
uc7.MouseUp += form_MouseUp;
uc7.MouseMove += delegate (object sender, MouseEventArgs e)
{
if (isDragging)
{
int diff = (e.Location.X - lastRectangle.X);
int x = (this.Location.X + diff);
this.Location = new Point(x, this.Location.Y);
this.Size = new Size((this.Width + (diff * -1)), (e.Y - lastRectangle.Y + this.Height));
}
};
uc7.BringToFront();
this.Controls.Add(uc7);
// bottom-left
UserControl uc8 = new UserControl()
{
Anchor = (AnchorStyles.Top | AnchorStyles.Left),
Height = resizeWidth,
Width = resizeWidth,
Left = 0,
Top = 0,
BackColor = Color.Transparent,
Cursor = Cursors.SizeNWSE
};
uc8.MouseDown += form_MouseDown;
uc8.MouseUp += form_MouseUp;
uc8.MouseMove += delegate (object sender, MouseEventArgs e)
{
if (isDragging)
{
int dX = (e.Location.X - lastRectangle.X);
int dY = (e.Location.Y - lastRectangle.Y);
int x = (this.Location.X + dX);
int y = (this.Location.Y + dY);
this.Location = new Point(x, y);
this.Size = new Size((this.Width + (dX * -1)), (this.Height + (dY * -1)));
}
};
uc8.BringToFront();
this.Controls.Add(uc8);
}
private void form_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
isDragging = true;
lastRectangle = new Rectangle(e.Location.X, e.Location.Y, this.Width, this.Height);
}
}
private void form_MouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
int x = (this.Location.X + (e.Location.X - lastRectangle.X));
int y = (this.Location.Y + (e.Location.Y - lastRectangle.Y));
this.Location = new Point(x, y);
}
}
private void form_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
}
}
}

BIN
2020/12/682-150x140.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
2020/12/682.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -1,148 +0,0 @@
using System;
using System.Drawing;
namespace RyzStudio.Drawing
{
public class Circle
{
public Circle()
{
}
public Circle(int x, int y, int width, int height)
{
this.X = x;
this.Y = y;
this.Width = width;
this.Height = height;
}
public Circle(Rectangle rectangle)
{
this.X = rectangle.X;
this.Y = rectangle.Y;
this.Width = rectangle.Width;
this.Height = rectangle.Height;
}
public Circle(Point position, Size size)
{
this.X = position.X;
this.Y = position.Y;
this.Width = size.Width;
this.Height = size.Height;
}
public Circle(Size size)
{
this.X = 0;
this.Y = 0;
this.Width = size.Width;
this.Height = size.Height;
}
public int X { get; set; } = 0;
public int Y { get; set; } = 0;
public int Width { get; set; } = 0;
public int Height { get; set; } = 0;
public PointF Origin
{
get
{
return new PointF()
{
X = (this.Width / 2) + this.X,
Y = (this.Height / 2) + this.Y
};
}
}
public int MinSideLength => Math.Min(this.Width, this.Height);
public static PointF GetPointromOrigin(PointF originPosition, Size size)
{
float offsetX = (size.Width / 2);
float offsetY = (size.Height / 2);
PointF rs = new PointF()
{
X = originPosition.X,
Y = originPosition.Y
};
rs.X -= offsetX;
rs.Y -= offsetY;
return rs;
}
public PointF GetPoint(int deg, int distance)
{
PointF origin = this.Origin;
PointF rs = new PointF()
{
X = origin.X,
Y = origin.Y
};
if (deg == 0)
{
rs.Y -= distance;
}
else if (deg == 90)
{
rs.X += distance;
}
else if (deg == 180)
{
rs.Y += distance;
}
else if (deg == 270)
{
rs.X -= distance;
}
else if ((deg > 0) && (deg < 90))
{
rs.X += (float)(distance * Math.Sin(calcToRad(deg)));
rs.Y -= (float)(distance * Math.Cos(calcToRad(deg)));
}
else if ((deg > 90) && (deg < 180))
{
rs.X += (float)(distance * Math.Cos(calcToRad(deg - 90)));
rs.Y += (float)(distance * Math.Sin(calcToRad(deg - 90)));
}
else if ((deg > 180) && (deg < 270))
{
rs.X -= (float)(distance * Math.Sin(calcToRad(deg - 180)));
rs.Y += (float)(distance * Math.Cos(calcToRad(deg - 180)));
}
else if ((deg > 270) && (deg < 360))
{
rs.X -= (float)(distance * Math.Cos(calcToRad(deg - 270)));
rs.Y -= (float)(distance * Math.Sin(calcToRad(deg - 270)));
}
// adjust position
rs.X += this.X;
rs.Y += this.Y;
return rs;
}
public void Deflate(int x, int y)
{
this.Width -= x;
this.Height -= y;
}
protected double calcToRad(int deg) => ((Math.PI / 180) * deg);
}
}

View File

@ -1,378 +0,0 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace RyzStudio.Windows.Forms
{
public class TImageButton : System.Windows.Forms.Label
{
public enum TImageBoxState
{
Disabled = 0,
Normal,
Hover,
Active
}
protected bool isEnabled = true;
protected bool isHover = false;
protected Color foreColor = Color.Black;
protected string text;
protected Size textSize = new Size();
protected DockStyle textAlign = DockStyle.Fill;
protected TImageBoxState controlState = TImageBoxState.Normal;
public TImageButton()
{
this.AutoEllipsis = true;
this.AutoSize = false;
this.BackColor = Color.Transparent;
//this.BackgroundImage = Properties.Resources.circle;
this.BackgroundImageLayout = ImageLayout.Center;
this.BorderStyle = BorderStyle.None;
this.CausesValidation = true;
this.DoubleBuffered = true;
this.FlatStyle = FlatStyle.Flat;
this.ForeColor = Color.Black;
this.ImageAlign = ContentAlignment.MiddleCenter;
//this.Margin = new Padding(0);
//this.MaximumSize = new Size(135, 135);
//this.MinimumSize = this.MaximumSize;
//this.Padding = new Padding(0);
//this.Size = this.MaximumSize;
base.TextAlign = ContentAlignment.MiddleCenter;
this.TextAlign = DockStyle.Fill;
this.UseCompatibleTextRendering = false;
this.UseMnemonic = true;
this.DisabledForeColor = Color.Black;
this.ControlState = TImageBoxState.Normal;
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override bool AllowDrop { get => base.AllowDrop; set => base.AllowDrop = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new bool AutoEllipsis { get => base.AutoEllipsis; set => base.AutoEllipsis = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override bool AutoSize { get => base.AutoSize; set => base.AutoSize = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override Color BackColor { get => base.BackColor; set => base.BackColor = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override Image BackgroundImage { get => base.BackgroundImage; set => base.BackgroundImage = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override ImageLayout BackgroundImageLayout { get => base.BackgroundImageLayout; set => base.BackgroundImageLayout = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new BorderStyle BorderStyle { get => base.BorderStyle; set => base.BorderStyle = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new bool CausesValidation { get => base.CausesValidation; set => base.CausesValidation = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override Cursor Cursor { get => base.Cursor; set => base.Cursor = value; }
//[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new bool Enabled
{
get => isEnabled;
set
{
isEnabled = value;
this.ControlState = (isEnabled ? TImageBoxState.Normal : TImageBoxState.Disabled);
}
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new FlatStyle FlatStyle { get => base.FlatStyle; set => base.FlatStyle = value; }
//[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
//public override Font Font { get => base.Font; set => base.Font = value; }
//[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override Color ForeColor { get => foreColor; set => foreColor = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Image Image { get => base.Image; set => base.Image = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new ContentAlignment ImageAlign { get => base.ImageAlign; set => base.ImageAlign = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new string ImageKey { get => base.ImageKey; set => base.ImageKey = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new int ImageIndex { get => base.ImageIndex; set => base.ImageIndex = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new ImageList ImageList { get => base.ImageList; set => base.ImageList = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new ImeMode ImeMode { get => base.ImeMode; set => base.ImeMode = value; }
//[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
//public new Padding Margin { get => base.Margin; set => base.Margin = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override Size MaximumSize { get => base.MaximumSize; set => base.MaximumSize = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override Size MinimumSize { get => base.MinimumSize; set => base.MinimumSize = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Padding { get => base.Padding; set => base.Padding = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override RightToLeft RightToLeft { get => base.RightToLeft; set => base.RightToLeft = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new object Tag { get => base.Tag; set => base.Tag = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
//public new string Text { get => base.Text; set => base.Text = value; }
public new string Text { get => base.Text; set => base.Text = string.Empty; }
[Category("Appearance")]
public string Text2
{
get => text;
set
{
base.Text = string.Empty;
text = value ?? string.Empty;
textSize = TextRenderer.MeasureText(text, this.Font);
}
}
//[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
//public new ContentAlignment TextAlign { get => base.TextAlign; set => base.TextAlign = value; }
[Category("Appearance")]
public new DockStyle TextAlign { get => textAlign; set => textAlign = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new bool UseCompatibleTextRendering { get => base.UseCompatibleTextRendering; set => base.UseCompatibleTextRendering = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new bool UseMnemonic { get => base.UseMnemonic; set => base.UseMnemonic = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new bool UseWaitCursor { get => base.UseWaitCursor; set => base.UseWaitCursor = value; }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
Point pos = calcTextPosition();
TextRenderer.DrawText(e.Graphics, this.Text2, this.Font, pos, base.ForeColor);
}
protected override void OnClick(EventArgs e)
{
if (this.Enabled || this.AllowClickOnDisabled)
{
base.OnClick(e);
}
}
protected override void OnDoubleClick(EventArgs e)
{
if (this.Enabled || this.AllowClickOnDisabled)
{
base.OnDoubleClick(e);
}
}
protected override void OnFontChanged(EventArgs e)
{
base.OnFontChanged(e);
this.Text2 = this.Text2;
}
protected override void OnMouseClick(MouseEventArgs e)
{
if (!this.Enabled && !this.AllowClickOnDisabled) return;
if (e.Button != MouseButtons.Left) return;
base.OnMouseClick(e);
}
protected override void OnMouseDoubleClick(MouseEventArgs e)
{
if (!this.Enabled && !this.AllowClickOnDisabled) return;
if (e.Button != MouseButtons.Left) return;
base.OnMouseDoubleClick(e);
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
this.ControlState = (this.Enabled ? TImageBoxState.Active : TImageBoxState.Disabled);
base.OnMouseDown(e);
}
protected override void OnMouseEnter(EventArgs e)
{
isHover = true;
this.ControlState = (this.Enabled ? (isHover ? TImageBoxState.Hover : TImageBoxState.Normal) : TImageBoxState.Disabled);
base.OnMouseEnter(e);
}
protected override void OnMouseLeave(EventArgs e)
{
isHover = false;
this.ControlState = (this.Enabled ? (isHover ? TImageBoxState.Hover : TImageBoxState.Normal) : TImageBoxState.Disabled);
base.OnMouseLeave(e);
}
protected override void OnMouseUp(MouseEventArgs e)
{
this.ControlState = (this.Enabled ? (isHover ? TImageBoxState.Hover : TImageBoxState.Normal) : TImageBoxState.Disabled);
base.OnMouseUp(e);
}
protected override void OnCreateControl()
{
base.OnCreateControl();
this.ControlState = this.ControlState;
this.AutoSize = false;
}
[Category("Appearance (Background)")]
public bool UseBackImage { get; set; } = true;
[Category("Appearance (Foreground)")]
public bool UseForeImage { get; set; } = false;
[Category("Appearance")]
public Color DisabledForeColor { get; set; }
[Category("Appearance")]
public int TextOffset { get; set; } = 0;
[Category("Behavior")]
public bool AllowClickOnDisabled { get; set; } = false;
[Category("Appearance (Foreground)")]
public Image NormalImage { get; set; } = null;
[Category("Appearance (Foreground)")]
public Image HoverImage { get; set; } = null;
[Category("Appearance (Foreground)")]
public Image ActiveImage { get; set; } = null;
[Category("Appearance (Foreground)")]
public Image DisabledImage { get; set; } = null;
[Category("Appearance (Background)")]
public Image NormalBackImage { get; set; } = null;
[Category("Appearance (Background)")]
public Image HoverBackImage { get; set; } = null;
[Category("Appearance (Background)")]
public Image ActiveBackImage { get; set; } = null;
[Category("Appearance (Background)")]
public Image DisabledBackImage { get; set; } = null;
protected TImageBoxState ControlState
{
get => controlState;
set
{
controlState = value;
switch (controlState)
{
case TImageBoxState.Disabled:
if (this.UseBackImage) this.BackgroundImage = this.DisabledBackImage;
if (this.UseForeImage) this.Image = this.DisabledImage;
base.ForeColor = this.DisabledForeColor;
break;
case TImageBoxState.Normal:
if (this.UseBackImage) this.BackgroundImage = this.NormalBackImage;
if (this.UseForeImage) this.Image = this.NormalImage;
base.ForeColor = this.ForeColor;
break;
case TImageBoxState.Hover:
if (this.UseBackImage) this.BackgroundImage = this.HoverBackImage;
if (this.UseForeImage) this.Image = this.HoverImage;
base.ForeColor = this.ForeColor;
break;
case TImageBoxState.Active:
if (this.UseBackImage) this.BackgroundImage = this.ActiveBackImage;
if (this.UseForeImage) this.Image = this.ActiveImage;
base.ForeColor = this.ForeColor;
break;
default: break;
}
}
}
protected Point calcTextPosition()
{
Point rs = new Point();
switch (this.TextAlign)
{
case DockStyle.Top:
rs.X = ((this.DisplayRectangle.Width - textSize.Width) / 2);
rs.Y = ((this.DisplayRectangle.Height / 2) - textSize.Height - this.TextOffset);
break;
case DockStyle.Bottom:
rs.X = ((this.DisplayRectangle.Width - textSize.Width) / 2);
rs.Y = ((this.DisplayRectangle.Height / 2) + this.TextOffset);
break;
case DockStyle.Left:
rs.X = ((this.DisplayRectangle.Width / 2) - textSize.Width - this.TextOffset);
rs.Y = ((this.DisplayRectangle.Height - textSize.Height) / 2);
break;
case DockStyle.Right:
rs.X = ((this.DisplayRectangle.Width / 2) + this.TextOffset);
rs.Y = ((this.DisplayRectangle.Height - textSize.Height) / 2);
break;
case DockStyle.Fill:
case DockStyle.None:
default:
rs.X = ((this.DisplayRectangle.Width - textSize.Width) / 2);
rs.Y = ((this.DisplayRectangle.Height - textSize.Height) / 2);
break;
}
return rs;
}
}
}

BIN
2020/12/circle-1-200.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
2020/12/circle-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
2020/12/circle-2-200.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
2020/12/circle-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
2020/12/circle.dia.autosave Normal file

Binary file not shown.

BIN
2020/12/circle.dia~ Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More