Exemple #1
0
        public void LoadSettings(string sAccountName)
        {
            Settings ste = new Settings(_rgsteeAccount, String.Format("Software\\Thetasoft\\AzLog\\{0}", sAccountName),
                                        sAccountName);

            ste.Load();
            m_ebAccountName.Text = sAccountName;
        }
Exemple #2
0
        public static bool EditStorageAccount(string sAccountName, Settings.SettingsElt[] rgsteeAccount)
        {
            AzAddAccount azaa = new AzAddAccount(rgsteeAccount);
            azaa.LoadSettings(sAccountName);
            azaa.ShowDialog();

            return true;
        }
Exemple #3
0
        public AzLog()
        {
            m_azlm = new AzLogModel();

            InitializeComponent();
            PopulateAccounts();
            m_ste = new Settings(_rgsteeApp, "Software\\Thetasoft\\AzLog", "App");
            m_ste.Load();
            m_sDefaultView = m_ste.SValue("DefaultView");
        }
Exemple #4
0
        public AzAddAccount(Settings.SettingsElt[] rgsteeAccount)
        {
            InitializeComponent();
            this.CancelButton = m_pbCancel;

            _rgsteeAccount = rgsteeAccount;
            for (int i = 0; i < _rgsteeAccount.Length; i++)
                {
                if (_rgsteeAccount[i].sRePath == "AccountKey")
                    _rgsteeAccount[i].oref = m_ebAccountKey;
                else if (_rgsteeAccount[i].sRePath == "StorageType")
                    _rgsteeAccount[i].oref = m_cbStorageType;
                else if (_rgsteeAccount[i].sRePath == "StorageDomain")
                    _rgsteeAccount[i].oref = m_ebAccountDomain;
                }
        }
        /* S A V E */
        /*----------------------------------------------------------------------------
            %%Function: Save
            %%Qualified: AzLog.AzLogViewSettings.Save
            %%Contact: rlittle

            Save is a little tricky. We load the settings into a new listview, which
            means that the taborder is the same as the column order. on save, though,
            the listview could have been reordered by the user, which means that the
            the tab order isn't necessarily the same as our column ordering.

            the client will tell use the tab ordering via an rgsColumns

            TODO: All this wacky "watch the user moving the columns" is unnecessary.
            Just use the DisplayIndex int he column header (see GetOrderedHeaders in
            ListViewSupp.cs)
        ----------------------------------------------------------------------------*/
        public void Save()
        {
            RegistryKey rk = Settings.RkEnsure(KeySettingsParent());

            // build a tab order reverse mapping
            int[] mpTabOrder = new int[m_pliazlvc.Count];

            for (int i = 0; i < m_pliazlvc.Count; i++)
                mpTabOrder[m_pliazlvc[i]] = i;

            rk.DeleteSubKeyTree(m_sName, false);
            rk.Close();

            rk = Settings.RkEnsure(KeySettings());

            for (int i = 0; i < ColumnCount(); i++)
                {
                AzLogViewColumn azlvc = Column(i);

                string sKey = String.Format("{0}\\{1}", KeySettings(), azlvc.Name);
                Settings ste = new Settings(_rgsteeColumn, sKey, azlvc.Name);

                ste.SetNValue("TabOrder", mpTabOrder[i]);
                ste.SetNValue("Width", azlvc.Width);
                ste.SetNValue("DataLogColumn", ((int) azlvc.DataColumn));
                ste.SetFValue("Visible", azlvc.Visible);
                ste.SetSValue("Title", azlvc.Title);

                ste.Save();
                }
            rk.Close();
            m_fDirty = false;
        }
        /* L O A D */
        /*----------------------------------------------------------------------------
            %%Function: Load
            %%Qualified: AzLog.AzLogViewSettings.Load
            %%Contact: rlittle

        ----------------------------------------------------------------------------*/
        public void Load()
        {
            RegistryKey rk = Registry.CurrentUser.OpenSubKey(KeySettings());

            if (rk == null)
                {
                SetDefault();
                return;
                }
            string[] rgs = rk.GetSubKeyNames();
            Settings ste;
            SortedList<int, Settings> mpnste = new SortedList<int, Settings>();

            foreach (string sColumn in rgs)
                {
                string sKey = String.Format("{0}\\{1}", KeySettings(), sColumn);
                ste = new Settings(_rgsteeColumn, sKey, sColumn);
                ste.Load();
                int nTabOrder = ste.NValue("TabOrder");
                mpnste.Add(nTabOrder, ste);
                }

            foreach (int nKey in mpnste.Keys)
                {
                ste = mpnste[nKey];

                int nWidth = ste.NValue("Width");
                AzLogEntry.LogColumn azlc = (AzLogEntry.LogColumn) ste.NValue("DataLogColumn");
                bool fVisible = ste.FValue("Visible");
                string sTitle = ste.SValue("Title");

                if (sTitle == "")
                    sTitle = (string) ste.Tag;

                AddLogViewColumn((string) ste.Tag, sTitle, nWidth, azlc, fVisible);
                }

            rk.Close();
            m_fDirty = false;
        }
        public void TestValueFromKey()
        {
            Settings ste = new Settings(new SettingsElt[]
                {
                new SettingsElt("TestString1", Settings.Type.Str, "1", ""),
                new SettingsElt("TestString2", Settings.Type.Str, "2", ""),
                new SettingsElt("TestInt161", Settings.Type.Int, (Int16) 1, ""),
                new SettingsElt("TestInt321", Settings.Type.Int, (Int32) 2, ""),
                new SettingsElt("TestDttm1", Settings.Type.Dttm, DateTime.Parse("1/1/1901"), ""),
                },
                                        "__UnitTestTest_TcoreSettings__", "tag");

            Assert.AreEqual("1", ste.SValue("TestString1"));
            Assert.AreEqual(1, ste.WValue("TestInt161"));
            Assert.AreEqual(2, ste.NValue("TestInt321"));
            Assert.AreEqual(DateTime.Parse("1/1/1901"), ste.DttmValue("TestDttm1"));
        }
Exemple #8
0
        /* C H A N G E  P R O F I L E */
        /*----------------------------------------------------------------------------
            %%Function: ChangeProfile
            %%Qualified: ArbWeb.AwMainForm.ChangeProfile
            %%Contact: rlittle

        ----------------------------------------------------------------------------*/
        private void ChangeProfile(object sender, EventArgs e)
        {
            if (!m_fDontUpdateProfile)
                {
                DoSaveStateCore();
                m_rehProfile = new Settings(m_rgreheProfile, String.Format("Software\\Thetasoft\\ArbWeb\\{0}", m_cbxProfile.Text), m_cbxProfile.Text);
                m_rehProfile.Load();
                }
        }
Exemple #9
0
        /* A W  M A I N  F O R M */
        /*----------------------------------------------------------------------------
            %%Function: AwMainForm
            %%Qualified: ArbWeb.AwMainForm.AwMainForm
            %%Contact: rlittle

        ----------------------------------------------------------------------------*/
        public AwMainForm(string[] rgsCmdLine)
        {
            //
            // Required for Windows Form Designer support
            //
            m_plCursor = new List<Cursor>();

            InitializeComponent();

            m_srpt = new StatusBox.StatusRpt(m_recStatus);
            m_awc = new ArbWebControl(m_srpt);
            m_fDontUpdateProfile = true;
            RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software\\Thetasoft\\ArbWeb");

            if (rk == null)
                rk = Registry.CurrentUser.CreateSubKey("Software\\Thetasoft\\ArbWeb");

            string []rgs = rk.GetSubKeyNames();

            foreach(string s in rgs)
                {
                m_cbxProfile.Items.Add(s);
                }
            m_rgreheProfile = new[]
                {
                    new Settings.SettingsElt("Login", Settings.Type.Str, m_ebUserID, ""),
                    new Settings.SettingsElt("Password", Settings.Type.Str, m_ebPassword, ""),
                    new Settings.SettingsElt("GameFile", Settings.Type.Str, m_ebGameFile, ""),
                    new Settings.SettingsElt("Roster", Settings.Type.Str, m_ebRoster, ""),
                    new Settings.SettingsElt("GameFileCopy", Settings.Type.Str, m_ebGameCopy, ""),
                    new Settings.SettingsElt("RosterCopy", Settings.Type.Str, m_ebRosterWorking, ""),
                    new Settings.SettingsElt("GameOutput", Settings.Type.Str, m_ebGameOutput, ""),
                    new Settings.SettingsElt("OutputFile", Settings.Type.Str, m_ebOutputFile, ""),
                    new Settings.SettingsElt("IncludeCanceled", Settings.Type.Bool, m_cbIncludeCanceled, 0),
                    new Settings.SettingsElt("ShowBrowser", Settings.Type.Bool, m_cbShowBrowser, 0),
                    new Settings.SettingsElt("LastSlotStartDate", Settings.Type.Dttm, m_dtpStart, ""),
                    new Settings.SettingsElt("LastSlotEndDate", Settings.Type.Dttm, m_dtpEnd, ""),
                    new Settings.SettingsElt("LastOpenSlotDetail", Settings.Type.Bool, m_cbOpenSlotDetail, 0),
                    new Settings.SettingsElt("LastGroupTimeSlots", Settings.Type.Bool, m_cbFuzzyTimes, 0),
                    new Settings.SettingsElt("LastTestEmail", Settings.Type.Bool, m_cbTestEmail, 0),
                    new Settings.SettingsElt("AddOfficialsOnly", Settings.Type.Bool, m_cbAddOfficialsOnly, 0),
                    new Settings.SettingsElt("AfiliationIndex", Settings.Type.Int, m_ebAffiliationIndex, 0),
                    new Settings.SettingsElt("LastSplitSports", Settings.Type.Bool, m_cbSplitSports, 0),
                    new Settings.SettingsElt("LastPivotDate", Settings.Type.Bool, m_cbDatePivot, 0),
                    new Settings.SettingsElt("LastLogToFile", Settings.Type.Bool, m_cbLogToFile, 0),
                    new Settings.SettingsElt("FilterMailMergeByRank", Settings.Type.Bool, m_cbFilterRank, 0),
                    new Settings.SettingsElt("DownloadOnlyFutureGames", Settings.Type.Bool, m_cbFutureOnly, 0),
                    new Settings.SettingsElt("LaunchMailMergeDoc", Settings.Type.Bool, m_cbLaunch, 0),
                    new Settings.SettingsElt("SetArbiterAnnouncement", Settings.Type.Bool, m_cbSetArbiterAnnounce, 0),
                };

            m_rgrehe = new []
                {
                    new Settings.SettingsElt("LastProfile", Settings.Type.Str, m_cbxProfile, "")
                };

            SetupLogToFile();

            m_reh = new Settings(m_rgrehe, "Software\\Thetasoft\\ArbWeb", "root");
            m_reh.Load();

            m_rehProfile = new Settings(m_rgreheProfile, String.Format("Software\\Thetasoft\\ArbWeb\\{0}", m_cbxProfile.Text), m_cbxProfile.Text);

            // load MRU from registry
            m_rehProfile.Load();
            m_fDontUpdateProfile = false;
            EnableControls();

            if (m_cbShowBrowser.Checked)
                m_awc.Show();

            CmdLineConfig clcfg = new CmdLineConfig(new CmdLineSwitch[]
                {
                new CmdLineSwitch("H", true /*fToggle*/, false /*fReq*/, "Update arbiter HELP NEEDED (includes downloading games, calculating slots). Requires -DS and -DE.", "help announce", null),
                new CmdLineSwitch("DS", false /*fToggle*/, false /*fReq*/, "Start date for slot calculation (required if -H specified)", "date start", null),
                new CmdLineSwitch("DE", false /*fToggle*/, false /*fReq*/, "End date for slot calculation (required if -H specified)", "date end", null),
                new CmdLineSwitch("F", false /*fToggle*/, false /*fReq*/, "Check this item in the Game/Slot filter", "Sport filter", null),
                new CmdLineSwitch("f", true /*fToggle*/, false /*fReq*/, "Force the games download to only download future games", "Future Games Only", null),
                });

            CmdLine cl = new CmdLine(clcfg);
            string sError = null;

            if (rgsCmdLine != null && rgsCmdLine.Length > 0)
                m_srpt.AddMessage(String.Format("Commandline args: {0} {1}", rgsCmdLine.Length, rgsCmdLine[0]));

            if (!cl.FParse(rgsCmdLine, this, null, out sError) || (m_fAutomateUpdateHelp && (m_sAutomateDateEnd == null || m_sAutomateDateStart == null)))
                {
                m_sbUsage = new StringBuilder();

                cl.Usage(AppendUsageString);
                MessageBox.Show(String.Format("Command Line error: {0}\n{1}", sError, m_sbUsage.ToString()), "ArbWeb");
                m_fAutomating = true;
                Close();
                }

            if (rgsCmdLine != null && rgsCmdLine.Length > 0)
                {
                m_fAutomating = true;

                if (m_fAutomateUpdateHelp)
                    {
                    DateTime dttmStart = DateTime.Parse(m_sAutomateDateStart);
                    DateTime dttmEnd = DateTime.Parse(m_sAutomateDateEnd);

                    m_cbLaunch.Checked = false;
                    m_cbSetArbiterAnnounce.Checked = true;
                    m_dtpStart.Value = dttmStart;
                    m_dtpEnd.Value = dttmEnd;
                    if (m_fForceFutureGames)
                        m_cbFutureOnly.Checked = true;

                    QueueUIOp(new DelayedUIOpDel(DoDownloadGames), new object[]{null, null});
                    QueueUIOp(new DelayedUIOpDel(CalcOpenSlots), new object[]{null, null});
                    QueueUIOp(new DelayedUIOpDel(DoCheckSportListboxes), new object[]{null, null});
                    QueueUIOp(new DelayedUIOpDel(GenMailMergeMail), new object[]{null, null});
                    QueueUIOp(new DelayedUIOpDel(DoExitApp), new object[]{null, null});

                    DoPendingQueueUIOp();
                    }
            }
        }
Exemple #10
0
        private void DoSave(object sender, EventArgs e)
        {
            string sAccountName = m_ebAccountName.Text;

            Settings ste = new Settings(_rgsteeAccount, String.Format("Software\\Thetasoft\\AzLog\\{0}", sAccountName),
                                        sAccountName);
            ste.Save();
            this.Close();
        }
Exemple #11
0
        /* A D D  S T O R A G E  A C C O U N T */
        /*----------------------------------------------------------------------------
            %%Function: AddStorageAccount
            %%Qualified: AzLog.AzAddAccount.AddStorageAccount
            %%Contact: rlittle

        ----------------------------------------------------------------------------*/
        public static bool AddStorageAccount(Settings.SettingsElt[] rgsteeAccount)
        {
            AzAddAccount azaa = new AzAddAccount(rgsteeAccount);

            return azaa.ShowDialog() == System.Windows.Forms.DialogResult.OK;
        }
Exemple #12
0
        private void m_pbOpen_Click(object sender, EventArgs e)
        {
            Settings ste = new Settings(_rgsteeAccount, KeyName, "main");
            ste.Load();

            m_azlm.OpenAccount((string) m_cbAccounts.SelectedItem, ste.SValue("AccountKey"));
            foreach (string s in m_azlm.Tables)
                m_lbTables.Items.Add(s);
        }