Giter Club home page Giter Club logo

neo-gui-wpf's Introduction

neo-gui

Full wallet for the NEO blockchain.

What?

  • Full node wallet for interacting with the NEO blockchain.
  • Port of official NEO GUI to WPF (Windows Presentation Foundation) using MVVM pattern (Model-View-ViewModel).
  • Note - Application is still being tested, please only use on testnet or private chains

Project Setup

On Linux:

yum install leveldb-devel

On Windows:

To build and run locally, you need to clone and build https://github.com/neo-project/leveldb first, then copy libleveldb.dll to the working directory (i.e. /bin/Debug, /bin/Release)

Note - When building, the project file settings must be changed from static library (lib) to dynamic linked library (dll).

Help

  • Open a new issue if you encountered a problem.
  • Or ping @lostfella or @AboimPinto in the NEO Discord Channel.
  • Submitting PRs to the project is always welcome!

License

  • Open-source MIT.

neo-gui-wpf's People

Contributors

aboimpinto avatar birmingh avatar danielcrenna avatar jonatanblockchain avatar justingaffney avatar localhuman avatar peterlinx avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neo-gui-wpf's Issues

Class structure in regions

The regions structure in classes should be:

Private Fields
Public Properties
Events
Constructor

(...)
Public Methods (in a View Model e should never have this Region. It's a smell that something is wrong)
Private Methods

Improve the way we get the balance of a Token

The code that determine the way to get the Token balance of an account it check if the Cast of the AssetId to UInt160 fail or not.
The fact that we are moving all this references to string, it's not possible to process this check.

In the AssetDto should be a enumeration that indicate what kind of the token is used.

IDialogViewModel dual behavior

The actual IDialogViewModel has two behavior implemented:

  • Close without return data
  • Close and return data

this two behavior should be implemented in two different interfaces in order to specialize each interface.

TransferViewModel with public methods

Public methods on VIewModel are a smell of wrong usage of the pattern. This public methods is called from the code-behind and should be refactor.

SQLite Error 1: 'no such table: @p0'

2017-11-13_11-25-51

发生了 Microsoft.Data.Sqlite.SqliteException
HResult=0x80004005
Message=SQLite Error 1: 'no such table: @p0'.
Source=<无法计算异常源>
StackTrace:
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues)
at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlCommand(DatabaseFacade databaseFacade, RawSqlString sql, IEnumerable`1 parameters)
at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlCommand(DatabaseFacade databaseFacade, FormattableString sql)
at Neo.Implementations.Wallets.EntityFramework.UserWallet.Rebuild()
at Neo.UI.Home.HomeViewModel.d__102.MoveNext() in C:\Users\fansh\Source\Repos\neo-gui-wpf\neo-gui\UI\Home\HomeViewModel.cs:line 702

CreateNewKey of CreateNewAddress method

Fowling the naming of the NEO assemblies, the method in the WalletController should be CreateNewKey, but, looks like that outcome is a new NEO address.

it is key or address?

WalletController should only return DTO objects

Due the fact the system still on top of the NEO assemblies, there are a huge dependency on the UI of this objects that are been bind.
The WalletController should be the level of abstraction between the NEO assemblies that control the BlockChain access and Wallet access and the rest of the application and no specific NEO objects should be pass to the UI but only DTO.

This mean that converts need to be in place and new objects need to be created in order to create this level of abstraction.

No changes in the NEO assemblies should break the NEO Wallet.

The object reference is not set to an instance of the object.

When I try to transfer assets,

发生了 System.NullReferenceException
HResult=0x80004003
Message=未将对象引用设置到对象的实例。
Source=neo-gui
StackTrace:
at Neo.UI.Base.Dialogs.InformationBox.Show(String text, String message, String title) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Base\Dialogs\InformationBox.xaml.cs:line 20
at Neo.UI.Base.Helpers.TransactionHelper.SignAndShowInformation(Transaction tx) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Base\Helpers\TransactionHelper.cs:line 38
at Neo.UI.Home.HomeViewModel.Transfer() in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Home\HomeViewModel.cs:line 772
at Neo.UI.Base.MVVM.RelayCommand.<>c__DisplayClass5_0.<.ctor>b__0(Object parameters) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Base\MVVM\RelayCommand.cs:line 18
at Neo.UI.Base.MVVM.RelayCommand.Execute(Object parameter) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Base\MVVM\RelayCommand.cs:line 35
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at Neo.Program.Main() in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\Program.cs:line 41

Clean up comments from ViewModels

On this ViewModels:

AssetRegistrationViewModel
DeployContractViewModel
ElectionViewModel
VotingViewModel

when the NEO type were removed, lot's of comments code remain in order to go back and review if something go wrong in the strategies.

HomeViewModel is subscribed 3 times in the messageSubscriber

OnLoad implementation of HomeViewModel is called 3 times upon starting.

1:
In DialogManager.cs/CreateDialog(): loadable?.OnLoad()
2:
In DataContextBindingExtensions.cs / ProvideValue(): loadableViewModel.OnLoad();
3:
In App.xaml.cs / Initialize(): loadableDataContext?.OnLoad();

On the GUI, when I do Advanced > Invoke contract, the InvokeContractDialog is opened once, and reopen 2 times after that when I close the window.

Refactor TxOutListBox

This control call several dialogs and for that the DialogHelper need to be injected.

PayToViewModel -> TryClose was not ported
BulkPayViewModel -> TryClose was not ported

Missing name from NEP-5 Tokens

When the WalletController need to list all the tokens in Wallet, the name of the NEP-5 Tokens are missing.

Before this was made by the internal object that represent the NEP-5. The same logic need to be added to the AssetDto.

Class: WalletController
Method: GetWalletAssets

When I clicked the "transfer" , here is the problem.

发生了 Autofac.Core.Registration.ComponentNotRegisteredException
HResult=0x80131500
Message=The requested service 'Neo.UI.Wallets.TransferViewModel' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
Source=Autofac
StackTrace:
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at Neo.UI.MarkupExtensions.DataContextBindingExtension.ProvideValue(IServiceProvider serviceProvider) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\MarkupExtensions\DataContextBindingExtension.cs:line 40
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)

Handling of the message SignTransactionAndShowInformationMessage in HomeViewModel is missplace

The handling of this message dependent on the WalletController and the BlockChainController to push the transaction.
This method also show InformationBox regarding the outcome of the operation therefore this need to receive the IDialogHelper and I'm sure the BlockChainController and WalletController should have this dependency. They should not have access to the UI thread, not to naviage to any modal or not modal windows or show any information.

I believe this controllers should publish message with the information and be catched by any active class that handle it showing the information or open a dialog

The collection has been modified; the enumeration may not be performed.

When I open the wallet file and sync,
enum

发生了 System.InvalidOperationException
HResult=0x80131509
Message=集合已修改;可能无法执行枚举操作。
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List1.Enumerator.MoveNextRare() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func`2 predicate)
at Neo.UI.Home.AssetsViewModel.GetAsset(UInt256 assetId) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Home\AssetsViewModel.cs:line 103
at Neo.UI.Home.HomeViewModel.UpdateAssetBalances() in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Home\HomeViewModel.cs:line 527
at Neo.UI.Home.HomeViewModel.UpdateBalances(TimeSpan persistenceSpan) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Home\HomeViewModel.cs:line 468
at Neo.UI.Home.HomeViewModel.UpdateWallet(Object sender, ElapsedEventArgs e) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Home\HomeViewModel.cs:line 442
at System.Timers.Timer.MyTimerCallback(Object state)

BlockchainController and WallerController should not have UI access

This controllers should not have any UI access to show information, success or in-success of the operations. Request for Yes/No questions should be provided by the initial UI operation.

To inform the UI of the ongoing to the operation there should be a NotificationHelper that should abstract the controllers from the way the information is show in the UI.

PayView show duplicated Assets

If there is several transactions made for a specific asset, the list on this view bring several lines with the same asset.

Patch WalletController in order to return just one type of Asset

UI Freeze when open the Wallet

Steps to reproduce
1º open the Wallet App and don't open the Wallet file
2º Let the app connect to a node and start sync
3º open a wallet file
UI Freeze

Remove Dispacher dependency in ViewModels

As concept, the ViewModel is part of the UI, therefore, all the code here should be already in the UiThread.

if the call is coming from WalletController or BlockchainController, they should be responsible to dispatch the execution to the UI Thread.

Implement DialogHelper

The DialogHelper is an helper that will abstract to implementation of the Dialog / Information / MessageBox show.

DialogHelper should be used only in the ViewModel level and NEVER on the Model level (BlockChainController, WalletController, etc.)

The usage of the DialogHelper it's a UI decision and never a model decision and the implementation should reflect this.

Application don't download the Blockchain

Finally I could start the app and I get this

image

Looks like that is sync with blockchain, the connected number goes up and down but the Height never change.
Don't know if there is an issue with my Office limitation or if there is communication issue.

How do I know where I'm connecting? Neo Network or test network?

Paulo

Replace Dialogs with information with Notifications

In order to keep the navigation simple as possible, every time that a dialog is show with a success, warning or failed message should be replaced by NotificationService. This change will help reducing the number of dialogs to be refactor when Mobile and new new interface will be created.

An error has occurred when I opened a wallet file.

发生了 System.NotSupportedException
HResult=0x80131515
Message=该类型的 CollectionView 不支持从调度程序线程以外的线程对其 SourceCollection 进行的更改。
Source=PresentationFramework
StackTrace:
at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Collections.ObjectModel.ObservableCollection1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection1.InsertItem(Int32 index, T item)
at Neo.UI.Home.TransactionsViewModel.UpdateTransactions(IEnumerable1 transactions) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Home\TransactionsViewModel.cs:line 72 at Neo.UI.Home.HomeViewModel.CurrentWallet_TransactionsChanged(Object sender, IEnumerable1 transactions) in C:\Users\fansh\Source\Repos\neo-gui-wpf2\neo-gui\UI\Home\HomeViewModel.cs:line 282
at Neo.Implementations.Wallets.EntityFramework.UserWallet.OnProcessNewBlock(Block block, IEnumerable1 added, IEnumerable1 changed, IEnumerable`1 deleted)
at Neo.Wallets.Wallet.ProcessNewBlock(Block block)
at Neo.Wallets.Wallet.ProcessBlocks()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

"Process.Start" calls need to be abstract

In order to improve testability, the calls "Process.Start" that has been used to open an URL Address need to be abstract with an interface.

Suggestion:
Create the interface IUrlNavigationHelper with the method "Navigate(Uri uri)"

this interface should be injected in the ViewModels that need to navigate to an URL and this call can be tested

Compiling the project is giving a XAMARIN error

hello
I got this project and try to compile local and I get this

image

I could not find any reference to Xamarin and didn't found any PCL in the solution.

what could be the issue?
Paulo Aboim Pinto

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.