mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-10 09:18:15 +11:00
batch: Added inital form
This commit is contained in:
parent
2760e485ce
commit
4f46c81765
140
FireWallet/BatchForm.Designer.cs
generated
Normal file
140
FireWallet/BatchForm.Designer.cs
generated
Normal file
@ -0,0 +1,140 @@
|
||||
namespace FireWallet
|
||||
{
|
||||
partial class BatchForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonCancel = new Button();
|
||||
buttonSend = new Button();
|
||||
groupBoxTransactions = new GroupBox();
|
||||
panelTXs = new Panel();
|
||||
buttonImport = new Button();
|
||||
buttonExport = new Button();
|
||||
groupBoxTransactions.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.FlatStyle = FlatStyle.Flat;
|
||||
buttonCancel.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonCancel.Location = new System.Drawing.Point(707, 401);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new System.Drawing.Size(81, 37);
|
||||
buttonCancel.TabIndex = 0;
|
||||
buttonCancel.TabStop = false;
|
||||
buttonCancel.Text = "Cancel Batch";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSend
|
||||
//
|
||||
buttonSend.FlatStyle = FlatStyle.Flat;
|
||||
buttonSend.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonSend.Location = new System.Drawing.Point(620, 401);
|
||||
buttonSend.Name = "buttonSend";
|
||||
buttonSend.Size = new System.Drawing.Size(81, 37);
|
||||
buttonSend.TabIndex = 1;
|
||||
buttonSend.TabStop = false;
|
||||
buttonSend.Text = "Send";
|
||||
buttonSend.UseVisualStyleBackColor = true;
|
||||
buttonSend.Click += buttonSend_Click;
|
||||
//
|
||||
// groupBoxTransactions
|
||||
//
|
||||
groupBoxTransactions.Controls.Add(panelTXs);
|
||||
groupBoxTransactions.Location = new System.Drawing.Point(0, 0);
|
||||
groupBoxTransactions.Name = "groupBoxTransactions";
|
||||
groupBoxTransactions.Size = new System.Drawing.Size(614, 438);
|
||||
groupBoxTransactions.TabIndex = 2;
|
||||
groupBoxTransactions.TabStop = false;
|
||||
groupBoxTransactions.Text = "Transactions";
|
||||
//
|
||||
// panelTXs
|
||||
//
|
||||
panelTXs.AutoScroll = true;
|
||||
panelTXs.Dock = DockStyle.Fill;
|
||||
panelTXs.Location = new System.Drawing.Point(3, 19);
|
||||
panelTXs.Name = "panelTXs";
|
||||
panelTXs.Size = new System.Drawing.Size(608, 416);
|
||||
panelTXs.TabIndex = 3;
|
||||
//
|
||||
// buttonImport
|
||||
//
|
||||
buttonImport.FlatStyle = FlatStyle.Flat;
|
||||
buttonImport.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonImport.Location = new System.Drawing.Point(620, 19);
|
||||
buttonImport.Name = "buttonImport";
|
||||
buttonImport.Size = new System.Drawing.Size(81, 37);
|
||||
buttonImport.TabIndex = 3;
|
||||
buttonImport.TabStop = false;
|
||||
buttonImport.Text = "Import";
|
||||
buttonImport.UseVisualStyleBackColor = true;
|
||||
buttonImport.Click += buttonImport_Click;
|
||||
//
|
||||
// buttonExport
|
||||
//
|
||||
buttonExport.FlatStyle = FlatStyle.Flat;
|
||||
buttonExport.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonExport.Location = new System.Drawing.Point(707, 19);
|
||||
buttonExport.Name = "buttonExport";
|
||||
buttonExport.Size = new System.Drawing.Size(81, 37);
|
||||
buttonExport.TabIndex = 4;
|
||||
buttonExport.TabStop = false;
|
||||
buttonExport.Text = "Export";
|
||||
buttonExport.UseVisualStyleBackColor = true;
|
||||
buttonExport.Click += buttonExport_Click;
|
||||
//
|
||||
// BatchForm
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(800, 450);
|
||||
Controls.Add(buttonExport);
|
||||
Controls.Add(buttonImport);
|
||||
Controls.Add(groupBoxTransactions);
|
||||
Controls.Add(buttonSend);
|
||||
Controls.Add(buttonCancel);
|
||||
FormBorderStyle = FormBorderStyle.Fixed3D;
|
||||
MaximizeBox = false;
|
||||
Name = "BatchForm";
|
||||
Text = "Batch";
|
||||
FormClosing += BatchForm_FormClosing;
|
||||
Load += BatchForm_Load;
|
||||
groupBoxTransactions.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonCancel;
|
||||
private Button buttonSend;
|
||||
private GroupBox groupBoxTransactions;
|
||||
private Panel panelTXs;
|
||||
private Button buttonImport;
|
||||
private Button buttonExport;
|
||||
}
|
||||
}
|
406
FireWallet/BatchForm.cs
Normal file
406
FireWallet/BatchForm.cs
Normal file
@ -0,0 +1,406 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.VisualBasic.Devices;
|
||||
using Point = System.Drawing.Point;
|
||||
|
||||
namespace FireWallet
|
||||
{
|
||||
public partial class BatchForm : Form
|
||||
{
|
||||
string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FireWallet\\";
|
||||
Dictionary<string, string> theme;
|
||||
MainForm mainForm;
|
||||
Batch[] batches;
|
||||
|
||||
|
||||
public BatchForm(MainForm mainForm)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.mainForm = mainForm;
|
||||
batches = new Batch[0];
|
||||
}
|
||||
public void AddBatch(string domain, string operation)
|
||||
{
|
||||
if (operation == "BID") return;
|
||||
batches = batches.Concat(new Batch[] { new Batch(domain, operation) }).ToArray();
|
||||
Panel tx = new Panel();
|
||||
tx.Left = 0;
|
||||
tx.Top = panelTXs.Controls.Count * 52 + 2;
|
||||
tx.Width = panelTXs.Width - SystemInformation.VerticalScrollBarWidth;
|
||||
tx.Height = 50;
|
||||
tx.BorderStyle = BorderStyle.FixedSingle;
|
||||
|
||||
Label action = new Label();
|
||||
action.Text = operation;
|
||||
action.Location = new Point(10, 10);
|
||||
action.AutoSize = true;
|
||||
tx.Controls.Add(action);
|
||||
Label target = new Label();
|
||||
target.Text = domain;
|
||||
target.Location = new Point(10, 30);
|
||||
target.AutoSize = true;
|
||||
tx.Controls.Add(target);
|
||||
|
||||
Button deleteTX = new Button();
|
||||
deleteTX.Text = "X";
|
||||
deleteTX.Location = new Point(tx.Width - 40, 10);
|
||||
deleteTX.Width = 25;
|
||||
deleteTX.Height = 25;
|
||||
deleteTX.TextAlign = ContentAlignment.MiddleCenter;
|
||||
deleteTX.Click += (sender, e) => { panelTXs.Controls.Remove(tx); FixSpacing(); };
|
||||
deleteTX.FlatStyle = FlatStyle.Flat;
|
||||
deleteTX.Font = new Font(deleteTX.Font.FontFamily, 9F, FontStyle.Bold);
|
||||
tx.Controls.Add(deleteTX);
|
||||
|
||||
panelTXs.Controls.Add(tx);
|
||||
UpdateTheme();
|
||||
}
|
||||
public void AddBatch(string domain, string operation, decimal bid, decimal lockup)
|
||||
{
|
||||
if (operation != "BID") return;
|
||||
batches = batches.Concat(new Batch[] { new Batch(domain, operation, bid, lockup) }).ToArray();
|
||||
Panel tx = new Panel();
|
||||
tx.Left = 0;
|
||||
tx.Top = panelTXs.Controls.Count * 52 + 2;
|
||||
tx.Width = panelTXs.Width - SystemInformation.VerticalScrollBarWidth;
|
||||
tx.Height = 50;
|
||||
tx.BorderStyle = BorderStyle.FixedSingle;
|
||||
|
||||
Label action = new Label();
|
||||
action.Text = operation;
|
||||
action.Location = new Point(10, 10);
|
||||
action.AutoSize = true;
|
||||
tx.Controls.Add(action);
|
||||
Label target = new Label();
|
||||
target.Text = domain;
|
||||
target.Location = new Point(10, 30);
|
||||
target.AutoSize = true;
|
||||
tx.Controls.Add(target);
|
||||
|
||||
Label bidLabel = new Label();
|
||||
bidLabel.Text = "Bid: " + bid.ToString();
|
||||
bidLabel.Location = new Point(200, 10);
|
||||
bidLabel.AutoSize = true;
|
||||
tx.Controls.Add(bidLabel);
|
||||
Label lockupLabel = new Label();
|
||||
lockupLabel.Text = "Lockup: " + lockup.ToString();
|
||||
lockupLabel.Location = new Point(200, 30);
|
||||
lockupLabel.AutoSize = true;
|
||||
tx.Controls.Add(lockupLabel);
|
||||
|
||||
Button deleteTX = new Button();
|
||||
deleteTX.Text = "X";
|
||||
deleteTX.Location = new Point(tx.Width - 40, 10);
|
||||
deleteTX.Width = 25;
|
||||
deleteTX.Height = 25;
|
||||
deleteTX.TextAlign = ContentAlignment.MiddleCenter;
|
||||
deleteTX.Click += (sender, e) => { panelTXs.Controls.Remove(tx); FixSpacing(); };
|
||||
deleteTX.FlatStyle = FlatStyle.Flat;
|
||||
deleteTX.Font = new Font(deleteTX.Font.FontFamily, 9F, FontStyle.Bold);
|
||||
tx.Controls.Add(deleteTX);
|
||||
|
||||
panelTXs.Controls.Add(tx);
|
||||
UpdateTheme();
|
||||
}
|
||||
|
||||
private void FixSpacing()
|
||||
{
|
||||
// Fix spacing from deleting a tx in the middle
|
||||
for (int i = 0; i < panelTXs.Controls.Count; i++)
|
||||
{
|
||||
panelTXs.Controls[i].Top = i * 52 + 2;
|
||||
}
|
||||
}
|
||||
#region Logging
|
||||
public void AddLog(string message)
|
||||
{
|
||||
StreamWriter sw = new StreamWriter(dir + "log.txt", true);
|
||||
sw.WriteLine(DateTime.Now.ToString() + ": " + message);
|
||||
sw.Dispose();
|
||||
}
|
||||
#endregion
|
||||
#region Theming
|
||||
private void UpdateTheme()
|
||||
{
|
||||
// Check if file exists
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
CreateConfig(dir);
|
||||
}
|
||||
if (!File.Exists(dir + "theme.txt"))
|
||||
{
|
||||
CreateConfig(dir);
|
||||
}
|
||||
|
||||
// Read file
|
||||
StreamReader sr = new StreamReader(dir + "theme.txt");
|
||||
theme = new Dictionary<string, string>();
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
string line = sr.ReadLine();
|
||||
string[] split = line.Split(':');
|
||||
theme.Add(split[0].Trim(), split[1].Trim());
|
||||
}
|
||||
sr.Dispose();
|
||||
|
||||
if (!theme.ContainsKey("background") || !theme.ContainsKey("background-alt") || !theme.ContainsKey("foreground") || !theme.ContainsKey("foreground-alt"))
|
||||
{
|
||||
AddLog("Theme file is missing key");
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply theme
|
||||
this.BackColor = ColorTranslator.FromHtml(theme["background"]);
|
||||
|
||||
// Foreground
|
||||
this.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
|
||||
|
||||
|
||||
// Need to specify this for each groupbox to override the black text
|
||||
foreach (Control c in Controls)
|
||||
{
|
||||
ThemeControl(c);
|
||||
}
|
||||
applyTransparency(theme);
|
||||
|
||||
|
||||
}
|
||||
private void ThemeControl(Control c)
|
||||
{
|
||||
if (c.GetType() == typeof(GroupBox) || c.GetType() == typeof(Panel))
|
||||
{
|
||||
c.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
|
||||
foreach (Control sub in c.Controls)
|
||||
{
|
||||
ThemeControl(sub);
|
||||
}
|
||||
}
|
||||
if (c.GetType() == typeof(TextBox) || c.GetType() == typeof(Button)
|
||||
|| c.GetType() == typeof(ComboBox) || c.GetType() == typeof(StatusStrip) || c.GetType() == typeof(ToolStrip))
|
||||
{
|
||||
c.ForeColor = ColorTranslator.FromHtml(theme["foreground-alt"]);
|
||||
c.BackColor = ColorTranslator.FromHtml(theme["background-alt"]);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTransparency(Dictionary<string, string> theme)
|
||||
{
|
||||
if (theme.ContainsKey("transparent-mode"))
|
||||
{
|
||||
switch (theme["transparent-mode"])
|
||||
{
|
||||
case "mica":
|
||||
var accent = new AccentPolicy { AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND };
|
||||
var accentStructSize = Marshal.SizeOf(accent);
|
||||
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||
var data = new WindowCompositionAttributeData
|
||||
{
|
||||
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||
SizeOfData = accentStructSize,
|
||||
Data = accentPtr
|
||||
};
|
||||
User32.SetWindowCompositionAttribute(Handle, ref data);
|
||||
Marshal.FreeHGlobal(accentPtr);
|
||||
break;
|
||||
case "key":
|
||||
if (theme.ContainsKey("transparency-key"))
|
||||
{
|
||||
switch (theme["transparency-key"])
|
||||
{
|
||||
case "alt":
|
||||
this.TransparencyKey = ColorTranslator.FromHtml(theme["background-alt"]);
|
||||
break;
|
||||
case "main":
|
||||
this.TransparencyKey = ColorTranslator.FromHtml(theme["background"]);
|
||||
break;
|
||||
default:
|
||||
this.TransparencyKey = ColorTranslator.FromHtml(theme["transparency-key"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLog("No transparency-key found in theme file");
|
||||
}
|
||||
break;
|
||||
case "percent":
|
||||
if (theme.ContainsKey("transparency-percent"))
|
||||
{
|
||||
Opacity = Convert.ToDouble(theme["transparency-percent"]) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLog("No transparency-percent found in theme file");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateConfig(string dir)
|
||||
{
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
StreamWriter sw = new StreamWriter(dir + "theme.txt");
|
||||
sw.WriteLine("background: #000000");
|
||||
sw.WriteLine("foreground: #8e05c2");
|
||||
sw.WriteLine("background-alt: #3e065f");
|
||||
sw.WriteLine("foreground-alt: #ffffff");
|
||||
sw.WriteLine("transparent-mode: off");
|
||||
sw.WriteLine("transparency-key: main");
|
||||
sw.WriteLine("transparency-percent: 90");
|
||||
sw.WriteLine("selected-bg: #000000");
|
||||
sw.WriteLine("selected-fg: #ffffff");
|
||||
sw.WriteLine("error: #ff0000");
|
||||
|
||||
sw.Dispose();
|
||||
AddLog("Created theme file");
|
||||
}
|
||||
|
||||
// Required for mica effect
|
||||
internal enum AccentState
|
||||
{
|
||||
ACCENT_DISABLED = 0,
|
||||
ACCENT_ENABLE_GRADIENT = 1,
|
||||
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||
ACCENT_INVALID_STATE = 4
|
||||
}
|
||||
|
||||
internal enum WindowCompositionAttribute
|
||||
{
|
||||
WCA_ACCENT_POLICY = 19
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct AccentPolicy
|
||||
{
|
||||
public AccentState AccentState;
|
||||
public int AccentFlags;
|
||||
public int GradientColor;
|
||||
public int AnimationId;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct WindowCompositionAttributeData
|
||||
{
|
||||
public WindowCompositionAttribute Attribute;
|
||||
public IntPtr Data;
|
||||
public int SizeOfData;
|
||||
}
|
||||
|
||||
internal static class User32
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void BatchForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
UpdateTheme();
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
mainForm.FinishBatch();
|
||||
AddLog("Batch Cancelled");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void buttonSend_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Send to do");
|
||||
}
|
||||
|
||||
private void BatchForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
mainForm.FinishBatch();
|
||||
}
|
||||
|
||||
private void buttonExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Filter = "CSV File|*.csv";
|
||||
saveFileDialog.Title = "Save Batch";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
StreamWriter sw = new StreamWriter(saveFileDialog.FileName);
|
||||
foreach (Batch b in batches)
|
||||
{
|
||||
sw.WriteLine(b.domain + "," + b.operation + "," + b.bid + "," + b.lockup);
|
||||
}
|
||||
sw.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filter = "CSV File|*.csv";
|
||||
openFileDialog.Title = "Open Batch";
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
StreamReader sr = new StreamReader(openFileDialog.FileName);
|
||||
string line;
|
||||
string[] domains = new string[0];
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
{
|
||||
string[] split = line.Split(',');
|
||||
if (split.Length == 2)
|
||||
{
|
||||
AddBatch(split[0], split[1]);
|
||||
}
|
||||
else if (split.Length == 4)
|
||||
{
|
||||
AddBatch(split[0], split[1], Convert.ToDecimal(split[2]), Convert.ToDecimal(split[3]));
|
||||
}
|
||||
else if (split.Length == 1)
|
||||
{
|
||||
// Select operation and import domains
|
||||
string operation = "OPEN";
|
||||
string[] newDomains = new string[domains.Length + 1];
|
||||
for (int i = 0; i < domains.Length; i++)
|
||||
{
|
||||
newDomains[i] = domains[i];
|
||||
}
|
||||
newDomains[domains.Length] = split[0].Trim();
|
||||
}
|
||||
}
|
||||
sr.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
public class Batch
|
||||
{
|
||||
public string domain { get; }
|
||||
public string operation { get; }
|
||||
public decimal bid { get; }
|
||||
public decimal lockup { get; }
|
||||
public Batch(string domain, string operation)
|
||||
{
|
||||
this.domain = domain;
|
||||
this.operation = operation;
|
||||
bid = 0;
|
||||
lockup = 0;
|
||||
}
|
||||
public Batch(string domain, string operation, decimal bid, decimal lockup)
|
||||
{
|
||||
this.domain = domain;
|
||||
this.operation = operation;
|
||||
this.bid = bid;
|
||||
this.lockup = lockup;
|
||||
}
|
||||
}
|
||||
}
|
120
FireWallet/BatchForm.resx
Normal file
120
FireWallet/BatchForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
2
FireWallet/DomainForm.Designer.cs
generated
2
FireWallet/DomainForm.Designer.cs
generated
@ -302,6 +302,7 @@
|
||||
buttonActionAlt.TabIndex = 1;
|
||||
buttonActionAlt.Text = "Bid in Batch";
|
||||
buttonActionAlt.UseVisualStyleBackColor = true;
|
||||
buttonActionAlt.Click += buttonActionAlt_Click;
|
||||
//
|
||||
// buttonActionMain
|
||||
//
|
||||
@ -322,6 +323,7 @@
|
||||
buttonExplorer.Name = "buttonExplorer";
|
||||
buttonExplorer.Size = new System.Drawing.Size(98, 34);
|
||||
buttonExplorer.TabIndex = 15;
|
||||
buttonExplorer.TabStop = false;
|
||||
buttonExplorer.Text = "Explorer";
|
||||
buttonExplorer.UseVisualStyleBackColor = true;
|
||||
buttonExplorer.Click += Explorer_Click;
|
||||
|
@ -30,7 +30,7 @@ namespace FireWallet
|
||||
string explorerTX;
|
||||
string explorerName;
|
||||
|
||||
public Form OriginalForm { get; set; }
|
||||
public MainForm mainForm { get; set; }
|
||||
|
||||
public DomainForm(string domain, string explorerTX, string explorerName)
|
||||
{
|
||||
@ -313,8 +313,6 @@ namespace FireWallet
|
||||
// No info -> Domain not yet auctioned
|
||||
labelStatusMain.Text = "Available";
|
||||
ActionSetup("AVAILABLE");
|
||||
AddLog(ex.Message);
|
||||
AddLog(result.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -818,5 +816,53 @@ namespace FireWallet
|
||||
};
|
||||
Process.Start(psi);
|
||||
}
|
||||
|
||||
private void buttonActionAlt_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (state == "BIDDING")
|
||||
{
|
||||
int count = textBoxBid.Text.Count(c => c == '.');
|
||||
int count2 = textBoxBlind.Text.Count(c => c == '.');
|
||||
if (count > 1 || count2 > 1)
|
||||
{
|
||||
NotifyForm notifyForm = new NotifyForm("Invalid bid amount");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
if (textBoxBid.Text == "" || textBoxBid.Text == ".")
|
||||
{
|
||||
textBoxBid.Text = "0";
|
||||
}
|
||||
if (textBoxBlind.Text == "" || textBoxBlind.Text == ".")
|
||||
{
|
||||
textBoxBlind.Text = "0";
|
||||
}
|
||||
decimal bid = Convert.ToDecimal(textBoxBid.Text);
|
||||
decimal blind = Convert.ToDecimal(textBoxBlind.Text);
|
||||
decimal lockup = bid + blind;
|
||||
|
||||
mainForm.AddBatch(domain, "BID", bid, lockup);
|
||||
this.Close();
|
||||
}
|
||||
else if (state == "CLOSED")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case "REVEAL":
|
||||
mainForm.AddBatch(domain, "REVEAL");
|
||||
this.Close();
|
||||
break;
|
||||
case "AVAILABLE":
|
||||
mainForm.AddBatch(domain, "OPEN");
|
||||
this.Close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,19 +17,20 @@ namespace FireWallet
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
#region Variables
|
||||
string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FireWallet\\";
|
||||
Dictionary<string, string> nodeSettings;
|
||||
Dictionary<string, string> userSettings;
|
||||
Dictionary<string, string> theme;
|
||||
int Network;
|
||||
string account;
|
||||
string password;
|
||||
decimal balance;
|
||||
decimal balanceLocked;
|
||||
int screen; // 0 = login, 1 = portfolio
|
||||
int height;
|
||||
double syncProgress;
|
||||
int pendingTransactions;
|
||||
public string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FireWallet\\";
|
||||
public Dictionary<string, string> nodeSettings { get; set; }
|
||||
public Dictionary<string, string> userSettings { get; set; }
|
||||
public Dictionary<string, string> theme { get; set; }
|
||||
public int Network { get; set; }
|
||||
public string account { get; set; }
|
||||
public string password { get; set; }
|
||||
public decimal balance { get; set; }
|
||||
public decimal balanceLocked { get; set; }
|
||||
public int height { get; set; }
|
||||
public double syncProgress { get; set; }
|
||||
public int pendingTransactions { get; set; }
|
||||
public bool batchMode { get; set; }
|
||||
BatchForm batchForm { get; set; }
|
||||
|
||||
#endregion
|
||||
#region Application
|
||||
@ -55,12 +56,12 @@ namespace FireWallet
|
||||
|
||||
ResizeForm();
|
||||
panelNav.Visible = false;
|
||||
screen = 0;
|
||||
|
||||
// Prompt for login
|
||||
GetAccounts();
|
||||
|
||||
AddLog("Loaded");
|
||||
batchMode = false;
|
||||
}
|
||||
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
@ -425,7 +426,6 @@ namespace FireWallet
|
||||
panelaccount.Visible = false;
|
||||
toolStripSplitButtonlogout.Visible = true;
|
||||
panelNav.Visible = true;
|
||||
screen = 1;
|
||||
buttonNavPortfolio.PerformClick();
|
||||
}
|
||||
}
|
||||
@ -465,7 +465,6 @@ namespace FireWallet
|
||||
panelDomains.Visible = false;
|
||||
panelPortfolio.Visible = false;
|
||||
toolStripStatusLabelaccount.Text = "Account: Not Logged In";
|
||||
screen = 0;
|
||||
textBoxaccountpassword.Focus();
|
||||
}
|
||||
#endregion
|
||||
@ -986,11 +985,12 @@ namespace FireWallet
|
||||
JObject APIresp = JObject.Parse(output);
|
||||
if (APIresp["error"].ToString() != "")
|
||||
{
|
||||
AddLog("Failed:");
|
||||
AddLog(APIresp.ToString());
|
||||
NotifyForm notify = new NotifyForm("Error Transaction Failed");
|
||||
notify.ShowDialog();
|
||||
return;
|
||||
}
|
||||
AddLog(APIresp.ToString());
|
||||
string hash = APIresp["result"].ToString();
|
||||
string link = userSettings["explorer-tx"] + hash;
|
||||
NotifyForm notifySuccess = new NotifyForm("Transaction Sent\nThis transaction could take up to 20 minutes to mine",
|
||||
@ -1027,11 +1027,45 @@ namespace FireWallet
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
DomainForm domainForm = new DomainForm(textBoxDomainSearch.Text, userSettings["explorer-tx"], userSettings["explorer-domain"]);
|
||||
domainForm.OriginalForm = this;
|
||||
domainForm.mainForm = this;
|
||||
|
||||
domainForm.Show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region Batching
|
||||
public void AddBatch(string domain, string operation)
|
||||
{
|
||||
if (operation == "BID") return;
|
||||
if (!batchMode)
|
||||
{
|
||||
batchForm = new BatchForm(this);
|
||||
batchForm.Show();
|
||||
batchMode = true;
|
||||
}
|
||||
batchForm.AddBatch(domain, operation);
|
||||
|
||||
}
|
||||
public void AddBatch(string domain, string operation, decimal bid, decimal lockup)
|
||||
{
|
||||
if (operation != "BID") return;
|
||||
if (!batchMode)
|
||||
{
|
||||
batchForm = new BatchForm(this);
|
||||
batchForm.Show();
|
||||
batchMode = true;
|
||||
}
|
||||
batchForm.AddBatch(domain, operation, bid, lockup);
|
||||
|
||||
}
|
||||
public void FinishBatch()
|
||||
{
|
||||
batchMode = false;
|
||||
batchForm.Dispose();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user