Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //GetInfo networkInfo = MicroCashFunctions.GetInfo();
            //GetHistory history = MicroCashFunctions.GetHistory("sSj4DdD5MExLgGBXrHxrNEr9WCfzBd2gx9");
            //int blockNumber = 123456;
            //BlockHeader networkBlock = MicroCashFunctions.GetBlockData(blockNumber);
            //GetInputs getinputs = MicroCashFunctions.GetInputs("sNvkB6KTsTyv5xPRo9Y4aq8D4AhnZZSEJE", 1000);

            /*
            ThinUser newuser = new ThinUser("user");
            for (int z = 0; z < 5; z++)
            {
                newuser.AddNewAccount("Savings Account");
            }
            newuser.Save();
            m_ThinUsers.Add(newuser);

            newuser = new ThinUser("Ahimoth");
            newuser.AddNewAccount("Savings Account");
            newuser.Save();
             * */

            trayMenu = new ContextMenu();
            trayMenu.MenuItems.Add("Exit", onExit);

            trayIcon      = new NotifyIcon();
            trayIcon.Text = "MicroCash";
            trayIcon.Icon = new Icon(SystemIcons.Application, 40, 40);
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible     = true;

            LoadSettings();
            m_ThinUser = m_ThinUsers[0];

            m_UserBMPList = new List<Bitmap>();
            m_UserBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.user_general.png")));
            m_UserBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.user_guy.png")));
            m_UserBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.user_guy2.png")));
            m_UserBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.user_woman.png")));

            m_AccountBMPList = new List<Bitmap>();
            m_AccountBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.account_sc.png")));
            m_AccountBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.account_mining.png")));
            m_AccountBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.account_savings.png")));
            m_AccountBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.account_checking.png")));
            m_AccountBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.account_heart.png")));
            m_AccountBMPList.Add(new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("MicroCash.Client.Thin.pngs.account_star.png")));

            DoConnectionPanel();

            m_UserPanel = new GradientPanel(Color.FromArgb(80, 80,110), Color.FromArgb(30, 30, 40),0);
            m_UserPanel.BorderStyle = BorderStyle.FixedSingle;

            m_LeftPanel = new GradientPanel(Color.FromArgb(64, 64, 64),Color.FromArgb(32,32,32),0);
            m_LeftPanel.AutoScroll = true;
            m_LeftPanel.MouseEnter += General_MouseEnter;

            m_BotPanel = new GradientPanel(Color.FromArgb(80, 80, 110), Color.FromArgb(30, 30,40), 0);
            m_BotPanel.BorderStyle = BorderStyle.FixedSingle;

            m_AddNewAccount = new Label();
            m_AddNewAccount.Text = "Add Account";
            m_AddNewAccount.TextAlign = ContentAlignment.MiddleCenter;

            m_AddNewAccount.BorderStyle = BorderStyle.FixedSingle;
            m_AddNewAccount.BackColor = Color.Transparent;
            m_AddNewAccount.ForeColor = Color.White;
            m_AddNewAccount.MouseEnter += addMouseEnter;
            m_AddNewAccount.MouseLeave += addMouseLeave;
            m_AddNewAccount.Cursor = Cursors.Hand;
            m_AddNewAccount.Click += userNewAccountClick;
            m_BotPanel.Controls.Add(m_AddNewAccount);

            m_AddNewUser = new Label();
            m_AddNewUser.Text = "Add User";
            m_AddNewUser.TextAlign = ContentAlignment.MiddleCenter;
            m_AddNewUser.BorderStyle = BorderStyle.FixedSingle;
            m_AddNewUser.BackColor = Color.Transparent;
            m_AddNewUser.ForeColor = Color.White;
            m_AddNewUser.MouseEnter += addMouseEnter;
            m_AddNewUser.MouseLeave += addMouseLeave;
            m_AddNewUser.Cursor = Cursors.Hand;
            m_AddNewUser.Click += userNewUserClick;
            m_BotPanel.Controls.Add(m_AddNewUser);

            //m_LeftPanel.Controls.Add(m_Logo);

            m_RightPanel = new Panel();
            m_RightPanel.BackColor = Color.FromArgb(32,32,32);

            m_UserImage = new PictureBox();
            m_UserImage.BackColor = Color.Transparent;
            m_UserImage.Location = new Point(5, 5);
            m_UserImage.Size = new Size(70, 70);
            m_UserImage.BackgroundImageLayout = ImageLayout.Stretch;
            m_UserImage.BackgroundImage = m_UserBMPList[m_ThinUser.m_icon];
            m_UserImage.Cursor = Cursors.Hand;

            m_UserText = new Label();
            m_UserText.BackColor = Color.Transparent;
            //m_UserText.ForeColor = Color.White;

            m_UserText.Font = new Font(Constants.FONTNAME, 18);
            m_UserText.Text = m_ThinUser.m_name;
            m_UserText.Cursor = Cursors.Hand;
            m_UserText.TextAlign = ContentAlignment.MiddleLeft;
            m_UserText.ForeColor = Color.White;

            m_UserTotalSC = new Label();
            m_UserTotalSC.BackColor = Color.Transparent;
            m_UserTotalSC.ForeColor = Color.FromArgb(192, 192, 192);
            m_UserTotalSC.Font = new Font(Constants.FONTNAMEMONO, 7, FontStyle.Bold);
            m_UserTotalSC.Text = "Balance:";
            m_UserTotalSC.Cursor = Cursors.Hand;
            m_UserTotalSC.TextAlign = ContentAlignment.MiddleLeft;
            m_UserTotalSC.AutoSize = true;

            m_UserTotalInterest = new Label();
            m_UserTotalInterest.BackColor = Color.Transparent;
            m_UserTotalInterest.ForeColor = Color.FromArgb(192, 192, 192);
            m_UserTotalInterest.Font = new Font(Constants.FONTNAMEMONO, 7, FontStyle.Bold);
            m_UserTotalInterest.Text = "Interest:";
            m_UserTotalInterest.Cursor = Cursors.Hand;
            m_UserTotalInterest.TextAlign = ContentAlignment.MiddleLeft;
            m_UserTotalInterest.AutoSize = true;

            ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(m_UserTotalSC, "This is how much MicroCash you have for all your accounts.\nThe number in brackets is your percentage of all the MicroCash currently existing");
            ToolTip1 = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(m_UserTotalInterest,
                "This is how much daily interest you get.\n\n"+
                "Each account in the MicroCash network requires a small daily fee,\n"+
                "These fees are then added up and given back to all the accounts proportionally\n"+
                "to the amount of MicroCash stored in each account. The more MicroCash in an\n"+
                "account the higher the percentage of interest you receive.");

            m_UserPanel.MouseEnter += userMouseEnter;
            m_UserPanel.MouseLeave += userMouseLeave;
            m_UserPanel.MouseClick += userMouseClick;
            m_UserText.MouseEnter += userMouseEnter;
            m_UserText.MouseLeave += userMouseLeave;
            m_UserText.MouseClick += userMouseClick;
            m_UserTotalSC.MouseEnter += userMouseEnter;
            m_UserTotalSC.MouseLeave += userMouseLeave;
            m_UserTotalSC.MouseClick += userMouseClick;
            m_UserTotalInterest.MouseEnter += userMouseEnter;
            m_UserTotalInterest.MouseLeave += userMouseLeave;
            m_UserTotalInterest.MouseClick += userMouseClick;

            m_UserImage.MouseClick += userAvatarClick;

            m_UserPanel.Controls.Add(m_UserImage);
            m_UserPanel.Controls.Add(m_UserText);
            m_UserPanel.Controls.Add(m_UserTotalSC);
            m_UserPanel.Controls.Add(m_UserTotalInterest);

            InitTabs();

            //this.Controls.Add(m_LogoPanel);
            this.Controls.Add(m_LeftPanel);
            this.Controls.Add(m_RightPanel);
            this.Controls.Add(m_UserPanel);
            this.Controls.Add(m_BotPanel);

            this.Resize += Form1_Resize;
            this.FormClosing += Form1_Close;

            //m_AccountItemsGUI[1] = new AccountItemGUI(1, m_LeftPanel, "Checking Account", "srTGvDYJzxHR752xTC3sAzDbwRadWWWecd", "100.00");
            //m_AccountItems[1] = new AccountItem(true,1,m_LeftPanel);
            switchUser();

            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = 1000;
            timer.Enabled = true;
            timer.Tick += OnTimerEvent;

            OnTimerEvent(null, null);

            m_RPCThread = new Thread(new ThreadStart(RPCThread));
            m_RPCThread.Start();

            m_RPCMutex.WaitOne();
            //for(int x=0;x<5000;x++) DoTransactionTest();
            m_RPCMutex.ReleaseMutex();

            //DoTransactionTest();
        }
Ejemplo n.º 2
0
 public Form1()
 {
     m_LastWWWListTry = new DateTime(1900,1,1);
     m_bUpdateNow = false;
     m_bRPCThreadQuit=false;
     m_bRPCThreadUpdate=true;
     m_qTotalSC = 0;
     m_qTotalAccounts = 0;
     m_AccountItemsGUI = null;
     m_ThinUsers = new List<ThinUser>();
     m_PublicNodeList = new List<string>();
     string folder = ".";
     System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(folder);
     foreach (System.IO.FileInfo f in dir.GetFiles("user_*.xml"))
     {
         ThinUser newuser = new ThinUser();
         newuser.LoadFromFile(f.Name);
         m_ThinUsers.Add(newuser);
     }
     InitializeComponent();
 }
Ejemplo n.º 3
0
 public void addNewUser(string name, string pass1, string pass2)
 {
     ThinUser newuser = new ThinUser();
     newuser.Create(name, pass1, pass2);
     newuser.AddNewAccount("Savings Account");
     newuser.Save();
     m_ThinUsers.Add(newuser);
 }
Ejemplo n.º 4
0
        private void userMouseClick(object sender, EventArgs e)
        {
            EventHandler onClick = new EventHandler(delegate(object s2, EventArgs e2)
            {
                MenuItem mi = (MenuItem)s2;
                m_RPCMutex.WaitOne();
                m_ThinUser = m_ThinUsers[mi.Index];
                m_RPCMutex.ReleaseMutex();
                switchUser();

            });
            ImageMenu menu = new ImageMenu(this, m_UserText.Font, onClick);
            foreach (ThinUser user in m_ThinUsers)
            {
                menu.AddItem(m_UserBMPList[user.m_icon], user.m_name);
            }
            menu.Show();
        }