Example #1
0
        public Task <string> DispatchRequestAsync(byte sourceType, string sourceAddress, byte destinationType, string destinationAddress, BigInteger tokenId)
        {
            var dispatchFunction = new DispatchFunction();

            dispatchFunction.SourceType         = sourceType;
            dispatchFunction.SourceAddress      = sourceAddress;
            dispatchFunction.DestinationType    = destinationType;
            dispatchFunction.DestinationAddress = destinationAddress;
            dispatchFunction.TokenId            = tokenId;

            return(ContractHandler.SendRequestAsync(dispatchFunction));
        }
Example #2
0
        public Task <TransactionReceipt> DispatchRequestAndWaitForReceiptAsync(byte sourceType, string sourceAddress, byte destinationType, string destinationAddress, BigInteger tokenId, CancellationTokenSource cancellationToken = null)
        {
            var dispatchFunction = new DispatchFunction();

            dispatchFunction.SourceType         = sourceType;
            dispatchFunction.SourceAddress      = sourceAddress;
            dispatchFunction.DestinationType    = destinationType;
            dispatchFunction.DestinationAddress = destinationAddress;
            dispatchFunction.TokenId            = tokenId;

            return(ContractHandler.SendRequestAndWaitForReceiptAsync(dispatchFunction, cancellationToken));
        }
        private async void DispatchButton_ClickAsync(object sender, RoutedEventArgs e)
        {
            var fxn = new DispatchFunction();

            fxn.SourceAddress      = ViewModel.SetUp.Accounts.one.Address;
            fxn.SourceType         = 0;
            fxn.DestinationAddress = (string.IsNullOrEmpty(_accountParam.Text) || string.IsNullOrWhiteSpace(_accountParam.Text)) ? ViewModel.SetUp.Accounts.two.Address : _accountParam.Text;
            fxn.DestinationType    = (string.IsNullOrEmpty(_typeParam.Text) || string.IsNullOrWhiteSpace(_typeParam.Text)) ? Convert.ToByte(1) : Convert.ToByte(_typeParam.Text);
            fxn.TokenId            = string.IsNullOrEmpty(tokenId.Text) || string.IsNullOrWhiteSpace(tokenId.Text) ? BigInteger.Parse(tokenId.Text) : new BigInteger(new Random().Next(10, 1000));
            ViewModel = DataContext as ManufacturerVM;
            await ViewModel.DispatchCommand(fxn);

            await UpdateTracking();
        }
Example #4
0
        /// <summary>
        /// Posts a function to be executed on the main thread of the webview.
        /// </summary>
        /// <param name="dispatchFunc">The function to call on the main thread</param>
        public void Dispatch(Action dispatchFunc)
        {
            DispatchFunction dispatchFuncInstance = null !;

            dispatchFuncInstance = new DispatchFunction((_, __) =>
            {
                lock (dispatchFunctions)
                {
                    dispatchFunctions.Remove(dispatchFuncInstance);
                }
                dispatchFunc();
            });

            lock (dispatchFunctions)
            {
                dispatchFunctions.Add(dispatchFuncInstance); // Pin the callback for the GC
            }

            Bindings.webview_dispatch(_nativeWebview, dispatchFuncInstance, IntPtr.Zero);
        }
 public DispatchingThread(DispatchFunction dispatchFunc)
 {
     m_dispatchFunc = dispatchFunc;
 }
Example #6
0
 internal extern static void webview_dispatch(IntPtr webview, DispatchFunction dispatchFunction, IntPtr args);
		public DispatchingThread(DispatchFunction dispatchFunc)
		{
			m_dispatchFunc = dispatchFunc;
		}
Example #8
0
 public Task <TransactionReceipt> DispatchRequestAndWaitForReceiptAsync(DispatchFunction dispatchFunction, CancellationTokenSource cancellationToken = null)
 {
     return(ContractHandler.SendRequestAndWaitForReceiptAsync(dispatchFunction, cancellationToken));
 }
Example #9
0
 public Task <string> DispatchRequestAsync(DispatchFunction dispatchFunction)
 {
     return(ContractHandler.SendRequestAsync(dispatchFunction));
 }