-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrected the display of transactions; added support for TX merging
- Loading branch information
Showing
14 changed files
with
229 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
using System.Globalization; | ||
using System.Collections.ObjectModel; | ||
using System.Globalization; | ||
|
||
namespace Jojatekok.MoneroAPI | ||
{ | ||
static class Helper | ||
{ | ||
public static readonly CultureInfo InvariantCulture = CultureInfo.InvariantCulture; | ||
|
||
public static void AddOrMergeTransaction(this ObservableCollection<Transaction> collection, Transaction item) | ||
{ | ||
for (var i = collection.Count - 1; i >= 0; i--) { | ||
var currentItem = collection[i]; | ||
|
||
if (currentItem.TransactionId == item.TransactionId && currentItem.IsAmountSpendable == item.IsAmountSpendable) { | ||
// TODO: Determine whether checking for the transaction's type is worthless | ||
if (currentItem.Type == item.Type) { | ||
currentItem.Amount += item.Amount; | ||
return; | ||
} | ||
} | ||
} | ||
|
||
collection.Add(item); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
{ | ||
public enum TransactionType | ||
{ | ||
Receive = 0, | ||
Send = 1 | ||
Unknown = 0, | ||
Receive = 1, | ||
Send = 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
namespace Jojatekok.MoneroGUI | ||
{ | ||
public class ConverterBooleanToString : IValueConverter | ||
{ | ||
public string FalseValue { get; set; } | ||
public string TrueValue { get; set; } | ||
|
||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value == null) return FalseValue; | ||
return (bool)value ? TrueValue : FalseValue; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
return value != null && value.Equals(TrueValue); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Jojatekok.MoneroAPI; | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
namespace Jojatekok.MoneroGUI | ||
{ | ||
public class ConverterTransactionTypeToString : IValueConverter | ||
{ | ||
public string UnknownValue { get; set; } | ||
public string ReceiveValue { get; set; } | ||
public string SendValue { get; set; } | ||
|
||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value == null) return UnknownValue; | ||
|
||
switch ((TransactionType)value) { | ||
case TransactionType.Receive: | ||
return ReceiveValue; | ||
|
||
case TransactionType.Send: | ||
return SendValue; | ||
|
||
default: | ||
return UnknownValue; | ||
} | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
var valueString = value as string; | ||
|
||
if (valueString == ReceiveValue) return TransactionType.Receive; | ||
if (valueString == SendValue) return TransactionType.Send; | ||
return TransactionType.Unknown; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters