Exemple #1
0
 private void LinkSinger()
 {
     System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(1.0);
     timer.Tick    += new EventHandler(async(_s, _e) => {
         if (!string.IsNullOrEmpty(Signer.Ins.CheckDevice()))//有签名机连接了
         {
             if (!_islinking)
             {
                 _islinking = true;
                 GetPackageInfo();
                 ShowUnlinkPage(true);
                 ShowBalloonTip("NeoDun已经连接");
             }
         }
         else
         {
             if (_islinking)
             {
                 ShowBalloonTip("NeoDun已经拔出");
                 _islinking = false;
             }
             ManagerControl.Ins.Release();
             ShowUnlinkPage(false);
             DialogueControl.CloseAllWindow();
         }
         await Task.Delay(1000);
     });
     timer.Start();
 }
Exemple #2
0
        //點擊卸載插件
        private async void Click_Uninstall(object sender, RoutedEventArgs e)
        {
            Button         btn         = (sender as Button);
            var            pluginType  = ((btn.Parent as StackPanel).Children[1] as Label).Content.ToString().Split(' ')[0];
            EnumPluginType content     = (EnumPluginType)Enum.Parse(typeof(EnumPluginType), pluginType);
            bool           needConfirm = false;

            foreach (var addr in Signer.Ins.addressPool.addresses)
            {
                if ((UInt16)addr.type == (UInt16)content)
                {
                    needConfirm = true;
                    break;
                }
            }
            if (needConfirm)
            {
                ND_MessageBoxResult nD_MessageBoxResult = await DialogueControl.ShowMessageBox("你有地址需要用到这个插件,是否确认卸载", ND_MessageBoxButton.OKCancel, 99999);

                if (nD_MessageBoxResult == ND_MessageBoxResult.OK)
                {
                    Result result = await ManagerControl.Ins.ToDo(EnumControl.UninstallPlugin, content);

                    GetPackageInfo();
                }
            }
        }
        private async void btn_Add(object sender, RoutedEventArgs e)
        {
            if (!ECDH.Ins.CheckM() || !ECDH.Ins.CheckResult)
            {
                DialogueControl.ShowVerityECDH(this);
            }
            if (ECDH.Ins.CheckResult)
            {
                Result result = await ManagerControl.Ins.ToDo(EnumControl.AddAddress, this.label_Wif.Text.ToString());

                this.Close();
                await Task.Delay(500);

                DialogueControl.ShowAddressListDialogue(this.Owner);

                //if (result.msgCode == EnumMsgCode.AddAddressSuc)
                //{
                //
                //}
                //else
                //{
                //    DialogueControl.ShowMessageDialogue(result.errorCode.ToString(), 2, this);
                //}
            }
        }
Exemple #4
0
        private void Btn_Add(object sender, RoutedEventArgs e)
        {
            // 使用一个IntPtr类型值来存储加密字符串的起始点
            IntPtr p = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this.pwb_pw.SecurePassword);

            // 使用.NET内部算法把IntPtr指向处的字符集合转换成字符串
            string password = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(p);

            if (string.IsNullOrEmpty(password))
            {
                DialogueControl.ShowMessageDialogue("请输入密码", 2, this);
                return;
            }

            this.DialogResult = true;
            if (nep6wallet == null)
            {
                DialogueControl.ShowMessageDialogue("错误的钱包格式", 2, this);
                return;
            }
            if (!ECDH.Ins.CheckM() || !ECDH.Ins.CheckResult)
            {
                DialogueControl.ShowVerityECDH(this.Owner);
            }
            if (ECDH.Ins.CheckResult)
            {
                DialogueControl.ShowImportAddressListDialogue(nep6wallet, password, this.Owner);
            }
        }
        private void Click_Copy(object sender, RoutedEventArgs e)
        {
            var           listboxitem = ((sender as Button).Parent as Grid).Parent as ListBoxItem;
            var           address     = (listboxitem.FindName("address") as Label).Content;
            StringBuilder Copystr     = new StringBuilder();

            Copystr.Append(address.ToString());
            Clipboard.SetText(Copystr.ToString());

            DialogueControl.ShowMessageDialogue(Mgr_Language.Ins.Code2Word("$page_copysuc"), 1, this);
        }
Exemple #6
0
 private void Btn_OpenFile(object sender, RoutedEventArgs e)
 {
     Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
     ofd.Filter = "*.json|*.json";
     if (ofd.ShowDialog() == true)
     {
         try
         {
             this.label_path.Text = ofd.FileName;
             nep6wallet           = new ThinNeo.NEP6.NEP6Wallet(this.label_path.Text);
         }
         catch (Exception err)
         {
             DialogueControl.ShowMessageDialogue(err.ToString(), 2, this);
         }
     }
 }
        private async void Click_SetName(object sender, RoutedEventArgs e)
        {
            this.gif_loading.Visibility = Visibility.Visible;
            Button  setName = sender as Button;
            TextBox tb      = (setName.Parent as Grid).FindName("name") as TextBox;
            Label   lb      = (setName.Parent as Grid).FindName("address") as Label;
            var     name    = tb.Text;
            var     address = lb.Content.ToString();

            byte[] bytes_name = System.Text.Encoding.UTF8.GetBytes(name);

            //string result = await driverControl.SetName(address, bytes_name);
            Result result = await ManagerControl.Ins.ToDo(EnumControl.SetName, address, bytes_name);

            this.gif_loading.Visibility = Visibility.Hidden;
            setName.Focus();
            setName.Visibility = Visibility.Hidden;

            DialogueControl.ShowMessageDialogue(result.errorCode.ToString(), 2, this);
        }
Exemple #8
0
 //點擊打開導入錢包頁面
 private void Btn_ImportWallet(object sender, RoutedEventArgs e)
 {
     DialogueControl.ShowImportWalletDialogue(this);
 }
Exemple #9
0
 //點擊打開地址管理頁面
 private void Btn_ManageAddr(object sender, RoutedEventArgs e)
 {
     DialogueControl.ShowAddressListDialogue(this);
 }