Example #1
0
        static void InitializeStructureMap(Settings settings)
        {
            try
            {
                ObjectFactory.Initialize(x =>
                    {
                        x.For<ISettings>()
                            .Singleton()
                            .Use(settings);

                        x.For<ILogger>()
                            .Singleton()
                            .Use<Logger>();

                        x.For<IQBRepository>().Use<QBRepository>();

                        x.For<IFileSystemRepository>().Use<FileSystemRepository>();

                        x.For<IEncryption>().Use<Encryption>();

                    }
                );
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was an error initializing StructureMap.  Program will close.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _error = true;
                return;
            }
        }
Example #2
0
        private static Settings InitializeSettings()
        {
            Settings settings = null;
            string path = "";

            try
            {
                path = Environment.CurrentDirectory + "\\AppData\\app.cfg";
                settings = new Settings();
                settings.Load(path);
            }
            catch (Exception ex)
            {

                MessageBox.Show("An error occurred while reading settings from disk at " + path
                            + Environment.NewLine + Environment.NewLine +
                            "Program will close.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _error = true;
            }

            return settings;
        }
 private ISettings GetPopulatedSettingsObj()
 {
     ISettings s = new Settings();
     s.MaxLogSizeBytes = 1000000;
     s.InStateTaxCodeName = "OKC Sales Tax";
     s.TaxableRate = .08375;
     s.TaxableState = "OK";
     s.OutOfStateTaxCodeName = "Out of State";
     //s.PendingOrdersPath = @"C:\Repositories\QuickBooks\trunk\bin\Debug\PendingOrders";
     s.IsInitialStartup = false;
     s.QbAppName = "CFIApplication";
     s.QuickBooksFilePath = @"C:\Shared\LeatherSeats.com\Customized Factory Interiors3.qbw";
     s.CustomerPrivateFieldsID = "{ABE77B20-5280-4f3b-BB4A-B66E5502D33A}";
     s.AppRootPath = @"C:\Repositories\QuickBooks\trunk\bin\Debug";
     return s;
 }