Skip to content

Commit

Permalink
Некоторые изменения и дополнения
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor-san committed Apr 18, 2019
1 parent 1ffb28c commit a27485f
Show file tree
Hide file tree
Showing 21 changed files with 1,198 additions and 985 deletions.
15 changes: 15 additions & 0 deletions x42Gui/Classes/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ public async Task<IEnumerable<string>> GetAccountsInWallet(string walletName)
}
}

internal async Task<long> GetBlockCount()
{
try
{
Error = String.Empty;
Url url = new Url(ApiUrl).AppendPathSegments("blockstore/getblockcount");
return await url.GetJsonAsync<long>();
}
catch (Exception ex)
{
Error = ex.Message;
return -1;
}
}

internal async Task<WalletHistoryModel> GetHistory(string walletName, string accountName = null)
{
try
Expand Down
51 changes: 51 additions & 0 deletions x42Gui/Classes/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using x42Gui.Models;

namespace x42Gui.Classes
{
public class Common
{


internal static UserSettings CurrentSettings = null;

internal static string LastError;
Expand All @@ -30,6 +33,54 @@ public class Common
/// </summary>
internal static List<AddressesModel> Addresses = null;

internal static string NetworkFolder
{
get
{
string name = "x42";

if (CurrentSettings.IsStratis)
{
name = "Stratis";
}

if (CurrentSettings.Mainnet)
{
name += "Main";
}
else
{
name += "Test";
}

string path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), name);

if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}

return path;
}
}

internal static string AddressesFile
{
get
{
return Path.Combine(Common.NetworkFolder, Constants.AddressesFileName);
}
}

internal static string WalletHistoryFile
{
get
{
return Path.Combine(Common.NetworkFolder, Constants.HistoryFileName);
}
}


internal static async Task<bool> LoadLocalWallets()
{
LastError = String.Empty;
Expand Down
1 change: 0 additions & 1 deletion x42Gui/Forms/CoinControlForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions x42Gui/Forms/MessageForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x42Gui/Forms/OptionsForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions x42Gui/Forms/OptionsForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@
LBJPBwODCRerKaiRfzKZv4evJLxyK100AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="buttonFromX42.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
Expand Down
19 changes: 17 additions & 2 deletions x42Gui/Forms/TransactionDetailsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,28 @@ public partial class TransactionDetailsForm : Form
string Status;
Money Fee;

public TransactionDetailsForm(HistoryRecord trans)
public TransactionDetailsForm(HistoryRecord trans, long blockCount)
{
InitializeComponent();

string confirmation=String.Empty;

StringBuilder sb = new StringBuilder();
//TODO это не число подтверждений а в каком блоке включена транзакция
Status = trans.ConfirmedInBlock == null ? "not in block" : $"in {trans.ConfirmedInBlock} block";
// Status = trans.ConfirmedInBlock == null ? "not in block" : $"in {trans.ConfirmedInBlock} block";
if (trans.ConfirmedInBlock == null)
{
Status = "not in block";
}
else
{
if (blockCount > 0)
{
confirmation =$", {blockCount - (long)trans.ConfirmedInBlock} confirmations";
}

Status = $"in {trans.ConfirmedInBlock} block {confirmation}";
}

sb.AppendLine($"Status: {Status}");
sb.AppendLine($"Date: {trans.Timestamp.DateTime}");
Expand Down
38 changes: 31 additions & 7 deletions x42Gui/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a27485f

Please sign in to comment.