Esempio n. 1
0
        // Base Constructor for the program
        public NewBalance()
        {
            #if DEBUG
            //ApplicationSettingsBase app = new Settings();
            //app.Reset();
            #endif
            InitializeComponent();

            if (Settings.Default.DefaultPath.Length < 4)
            {
                FirstRunPopup first = new FirstRunPopup();

                first.ShowDialog();

                if (first.DialogResult == DialogResult.OK)
                {
                    FolderBrowserDialog f = new FolderBrowserDialog();

                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        Settings.Default.DefaultPath = f.SelectedPath;
                    }

                    Settings.Default.Save();
                }
            }

            App = new AppLoader(Settings.Default.DefaultPath);

            Balance = DefaultBalance();

            if (Balance == null || !Balance.IsBalanceConnected())
            {
                Balance = null;
                readBalanceButton.Enabled = false;
                readBalanceButton.Text = @"Disconnected";
            }
            else
            {
                // update command being sent to the balance on click
                Balance.UpdateCommand();
                readBalanceButton.Enabled = true;
                readBalanceButton.Text = @"Read Balance";
            }

            addRowButton.Enabled = false;
        }
Esempio n. 2
0
        // Base Constructor for the program
        public NewBalance()
        {
#if DEBUG
            //ApplicationSettingsBase app = new Settings();
            //app.Reset();
#endif
            InitializeComponent();

            if (Settings.Default.DefaultPath.Length < 4)
            {
                FirstRunPopup first = new FirstRunPopup();

                first.ShowDialog();

                if (first.DialogResult == DialogResult.OK)
                {
                    FolderBrowserDialog f = new FolderBrowserDialog();

                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        Settings.Default.DefaultPath = f.SelectedPath;
                    }

                    Settings.Default.Save();
                }
            }

            App = new AppLoader(Settings.Default.DefaultPath);

            Balance = DefaultBalance();

            if (Balance == null || !Balance.IsBalanceConnected())
            {
                Balance = null;
                readBalanceButton.Enabled = false;
                readBalanceButton.Text    = @"Disconnected";
            }
            else
            {
                // update command being sent to the balance on click
                Balance.UpdateCommand();
                readBalanceButton.Enabled = true;
                readBalanceButton.Text    = @"Read Balance";
            }

            addRowButton.Enabled = false;
        }