Beispiel #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            string       ConfigFile = "config.lxm";
            LiteIDConfig Config     = LiteIDConfig.Load(ConfigFile);

            SetContentView(Resource.Layout.Options);
            Button   buttonGenerateAccount = FindViewById <Button>(Resource.Id.buttonGenerateAccount);
            Button   buttonResetID         = FindViewById <Button>(Resource.Id.buttonResetID);
            TextView textCurrentID         = FindViewById <TextView>(Resource.Id.textCurrentID);

            if (Config.Configured)
            {
                textCurrentID.Text = "0x" + LiteIDContext.BytesToHex(Config.BlockchainID);
            }
            else
            {
                textCurrentID.Text = "No ID - You must deploy a new contract.";
            }
            EditText textRPCAddress = FindViewById <EditText>(Resource.Id.textRPCAddress);
            Button   buttonSaveRPC  = FindViewById <Button>(Resource.Id.buttonSaveRPC);

            buttonGenerateAccount.Click += delegate
            {
                Toast.MakeText(this.ApplicationContext, "No connection; demo mode", ToastLength.Long).Show();
            };

            buttonResetID.Click += delegate
            {
                Config.BlockchainID = new byte[32];
                Random random = new Random();
                random.NextBytes(Config.BlockchainID);
                textCurrentID.Text = "0x" + LiteIDContext.BytesToHex(Config.BlockchainID);
                Config.Configured  = true;
                Config.Save(ConfigFile);
            };

            buttonSaveRPC.Click += delegate
            {
                Config.RPCAddress = textRPCAddress.Text;
                Config.Save(ConfigFile);
            };
        }
Beispiel #2
0
 public void SaveAll()
 {
     DocStore.SaveList(DocStoreFile);
     Config.Save(ConfigFile);
 }