Exemplo n.º 1
0
		public App()
		{
			try
			{
			    InitializeComponent();

				var logger = new ApplicationLogger();

				Logger.Register(logger);

				this.InstallExceptionHandler(new TestExceptionHandler(this, logger, false));

				ThreadingFactory.Set(new ApplicationTaskScheduler(logger));

				var container = new WindsorContainer();

				var configuration = new Configuration.Configuration(container);

				configuration.Install();

				DialogService.ShowMain(new MainViewModel(configuration.BaseApiUrl));
			}
			catch (Exception exception)
			{
				Logger.Error(exception);
			}
		}
Exemplo n.º 2
0
        public static void Run(ILog log)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, args) => log.Error(args.ExceptionObject.ToString());

            var configuration = new Configuration.Configuration();
            var host = new ServiceHost(new WebSiteService(), new Uri(string.Format("http://{0}:{1}", Environment.MachineName, configuration.WebSiteHost)));

            host.AddServiceEndpoint(typeof(IWebSiteService), new WebHttpBinding(), "")
                .Behaviors.Add(new WebHttpBehavior { DefaultOutgoingResponseFormat = WebMessageFormat.Json, DefaultOutgoingRequestFormat = WebMessageFormat.Json });
            host.Open();
            log.Info("Web communication host has been successfully opened");

            while (true)
            {

                try
                {
                    new AutomatedPostReview(log, configuration).Run();
                }
                catch (Exception ex)
                {
                    log.Error(ex.ToString());
                }
                Thread.Sleep(configuration.Timeout);
            }
        }
Exemplo n.º 3
0
 public MeekController()
 {
     _config = BootStrapper.Configuration;
     _repository = BootStrapper.Configuration.GetRepository();
     _auth = BootStrapper.Configuration.GetAuthorization();
     _thumbnailGenerators = BootStrapper.Configuration.GetThumbnailGenerators();
 }
Exemplo n.º 4
0
 protected MeekController(Configuration.Configuration config)
 {
     _config = config;
     _repository = config.GetRepository();
     _auth = config.GetAuthorization();
     _thumbnailGenerators = config.GetThumbnailGenerators();
 }
Exemplo n.º 5
0
 public void Initialize( string configFilePath )
 {
     if ( _driverFactory != null ) {
         return;
     }
     _mappings = new Dictionary<string, EntityMapping> ();
     if ( string.IsNullOrEmpty ( configFilePath ) ) {
         _configuration = new ConfigManager ().GetSystemConfiguration ();
     } else {
         _configuration = new ConfigManager ( configFilePath ).GetSystemConfiguration ();
     }
     switch ( _configuration.DatabaseType ) {
         case DatabaseType.Odbc: _driverFactory = new OdbcDriverFactory ();
             break;
         case DatabaseType.OleDb: _driverFactory = new OleDbDriverFactory ();
             break;
         case DatabaseType.Oracle: _driverFactory = new OracleDriverFactory ();
             break;
         case DatabaseType.SQLServer: _driverFactory = new SQLDriverFactory ();
             break;
     }
     _driverFactory.ConnectionString = _configuration.ConnectionString;
     foreach ( EntityMapping map in _configuration.Mappings ) {
         _mappings.Add ( map.ClassName, map );
     }
     LogHelper.LogHelper.InitLog ( configFilePath );
 }
        /// <summary>
        ///     Start service.
        /// </summary>
        public void Start() {
            if (!File.Exists("config.json")) {
                Logger.Error("Configuration file \"config.json\" was not found in the application directory!");
                return;
            }

            // configuration
            var configurationBuilder = new ConfigurationBuilder().AddJsonFile("config.json").Build();
            var configuration = new Configuration.Configuration();
            configurationBuilder.Bind(configuration);

            // do the dirty work
            foreach (var mailBox in configuration.MailBoxes) {
                var cancellationTokenSource = Scheduler.Interval(mailBox.Interval, () => {
                    var mailBoxProcessor = new MailBoxProcessor(mailBox);

                    try {
                        mailBoxProcessor.Process();
                    }
                    catch (Exception ex) {
                        Logger.Error($"Could not process the MailBox {mailBox.Identifier}!", ex);
                    }
                });

                _cancellationTokenSources.Add(cancellationTokenSource);
            }
        }
Exemplo n.º 7
0
        public static void Main(string[] args)
        {
            // TODO: We never dispose of the file stream
            var config = new Configuration.Configuration(new FileStream(@"C:\BentBot\bentbot.config", FileMode.Open));

            var bot = new Bot(config, new AgsXmppBackend(config));

            bot.RunAsync().Wait();
        }
 public AutomatedPostReview(ILog log, Configuration.Configuration config)
 {
     this.log = log;
     this.config = config;
     api = new ReviewboardApi(new Uri(config.ReviewBoardServer),
                                  new NetworkCredential(config.ReviewBoardUserName, config.ReviewBoardPassword));
     var teamProjectCollection = new TfsTeamProjectCollection(config.ServerUri);
     vcs = teamProjectCollection.GetService<VersionControlServer>();
 }
Exemplo n.º 9
0
 internal GraphicResources(Configuration.Configuration config, ContentManager content)
 {
     DefaultArrowTexture = new XnaTexture2D(config.DefaultArrowTexture, content);
     DefaultFont = new XnaSpriteFont(config.DefaultFont, content);
     DefaultBorderTexture = new XnaTexture2D(config.DefaultBorderTexture, content);
     pixel = new XnaTexture2D();
     Cup = new XnaTexture2D("circle", content);
     ContentManager = content;
     Configuration = config;
 }
Exemplo n.º 10
0
        public static void Main(string[] args)
        {
            try
            {
                
                BulkLoader inserter;
                Console.WriteLine();
                Console.Title = "StackOverflow Data Dump Import v.10";
                Console.WriteLine(Console.Title);
                Console.WriteLine();
                if(args.ToList().Find(a=>a.ToLowerInvariant()=="help" || a.ToLowerInvariant()=="?")!=null)
                {
                    RenderUsage();
                    return;
                }
                Configuration.Configuration config = new Configuration.Configuration(args);
                Console.WriteLine(config.ToString(false));

                if (config.GUI || args.Length == 0)
                {
                    Application.EnableVisualStyles();
                    Application.Run(new FrmUI(config)); // or whatever
                }
                else
                {
                    inserter = BulkLoader.Create(config);

                    inserter.RowsInserted += (s, e) =>
                        {
                            if (e.Type == CopyEventType.Error)
                            {
                                Console.WriteLine(e.Message);
                            }
                        };

                    Stopwatch sw = new Stopwatch();

                    sw.Start();
                    inserter.ProcessJobs(config);
                    sw.Stop();

                    long count = inserter.Jobs.Select(j => j.Tasks.Sum(t => t.Count)).Sum();
                    Console.WriteLine(Resources.Rs_ImpComplete + "\r\n", count.ToString("#,##0"),
                                      sw.ElapsedMilliseconds / 1000f / 60f);
                }
            }
            catch (Exception ex)
            {
                
                Console.WriteLine("\r\n{0}\r\n",ex.Message);
                RenderUsage();
            }
        }
Exemplo n.º 11
0
        public void TestSetup()
        {
            var systemBuilder = new SystemBuilder();
            systemContext = systemBuilder.BuildSystem();

            var test = TestContext.CurrentContext.Test.Name;

            if (test != "CreateNew" &&
                test != "DatabaseNotExists") {
                var dbConfig = new Configuration.Configuration();
                dbConfig.SetValue("database.name", TestDbName);
                database = systemContext.CreateDatabase(dbConfig, TestAdminUser, TestAdminPass);
            }
        }
Exemplo n.º 12
0
        public Form1()
        {
            InitializeComponent();

            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            var internalCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var pluginCatalog = new DirectoryCatalog("Extensions");
            var aggCatalog = new AggregateCatalog(internalCatalog, pluginCatalog);
            _container = new CompositionContainer(aggCatalog);

            ServiceLocator.SetServiceLocator(new MefServiceLocator(_container));

            ConfigurationReader cr = new ConfigurationReader();
            _cfg = cr.GetConfiguration();
            ApplyConfiguration();

            ucDeviceManagement.Initialize(_cfg);
            ucApplicationManager.Initialize(_cfg);

            System.Windows.Forms.Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
        }
Exemplo n.º 13
0
 public PopupViewModel(IConfigurationManager configurationManager)
 {
     _config = configurationManager.Config;
     OpenInBrowserCommand = new DelegateCommand(OpenInBrowser, () => true);
     IconSource           = new Uri("pack://application:,,,/Images/bamboo.ico");
 }
Exemplo n.º 14
0
 public async Task <object> ProcessData(Configuration.Configuration config)
 {
     return(await _newsFactory.GetNewsAsync(config));
 }
Exemplo n.º 15
0
        private void CreateContext()
        {
            System = CreateSystem();

            var dbConfig = new Configuration.Configuration();
            dbConfig.SetValue("database.name", DatabaseName);

            Database = CreateDatabase(System, dbConfig);
            Session = CreateAdminSession(Database);
            Query = CreateQuery(Session);
        }
Exemplo n.º 16
0
 protected abstract void ConfigureConnectionStringProvider(Configuration.Configuration configuration);
 /**
  * @constructor
  * @param configuration - contains the configuration information for this application.
  * @param yearNumber - The number for this year.
  */
 public Year(Configuration.Configuration configuration, string yearNumber)
 {
     _configuration = configuration;
     YearNumber     = yearNumber;
 }
Exemplo n.º 18
0
        private static IConfiguration CreateSimpleConfig(ISystemContext systemContext, string dbName)
        {
            if (String.IsNullOrEmpty(dbName))
                throw new ArgumentNullException("dbName");

            var config = new Configuration.Configuration(systemContext.Configuration);
            config.SetValue("database.name", dbName);
            return config;
        }
Exemplo n.º 19
0
        public async Task <ViewModel.Weather> GetWeather(Configuration.Configuration config)
        {
            ViewModel.Weather weather = new ViewModel.Weather();
            WeatherNet.ClientSettings.ApiUrl = config.WeatherAPIUrl;
            WeatherNet.ClientSettings.ApiKey = config.WeatherAPIKey;

            // get current weather info
            var currentWeather = await WeatherNet.Clients.CurrentWeather.GetByCityNameAsync(
                config.WeatherCity, config.WeatherCountry, config.WeatherLanguage, config.WeatherUnits);

            if (!currentWeather.Success)
            {
                return(null);
            }

            weather.BeaufortWindScale = WIWindBeaufort.Beaufort[WIWindBeaufort.KMHToBeaufort(currentWeather.Item.WindSpeed)];
            var now = DateTimeFactory.Instance.Now;

            weather.SunState     = WIWeather.Sunrise;
            weather.SunStateTime = currentWeather.Item.Sunrise.ToString("HH:mm");
            if (currentWeather.Item.Sunrise < now && currentWeather.Item.Sunset > now)
            {
                weather.SunState     = WIWeather.Sunset;
                weather.SunStateTime = currentWeather.Item.Sunset.ToString("HH:mm");
            }

            weather.Temperature = string.Format("{0:0.0}°", currentWeather.Item.Temp);
            weather.WeatherIcon = WIWeather.IconTable[currentWeather.Item.Icon];

            var forecastDaily = await WeatherNet.Clients.FiveDaysForecast.GetByCityNameDailyAsync(config.WeatherCity, config.WeatherCountry, config.WeatherLanguage, config.WeatherUnits);

            var forecastDetail = await WeatherNet.Clients.FiveDaysForecast.GetByCityNameAsync(config.WeatherCity, config.WeatherCountry, config.WeatherLanguage, config.WeatherUnits);


            if (forecastDaily.Success)
            {
                foreach (var item in forecastDaily.Items)
                {
                    var forecast = new ViewModel.WeatherForecast();
                    forecast.Icon     = WIWeather.IconTable[item.Icon];
                    forecast.Day      = item.Date.ToString("ddd.");
                    forecast.MaxTemp  = string.Format("{0:0.0}°", item.TempMax);
                    forecast.MinTemp  = string.Format("{0:0.0}°", item.TempMin);
                    forecast.Temp     = string.Format("{0:0.0}°", item.Temp);
                    forecast.DMaxTemp = item.TempMax;
                    forecast.DMinTemp = item.TempMin;
                    forecast.DateTime = item.Date.Date;
                    weather.Forecasts.Add(forecast);

                    if (forecastDaily.Success)
                    {
                        var detailForecast = new ViewModel.WeatherForecast();
                        detailForecast.Update(forecast);

                        if (detailForecast.DateTime.Day == now.Day)
                        {
                            detailForecast.Day = "Heute";
                        }
                        else
                        {
                            detailForecast.Day = forecast.DateTime.ToString("dddd");
                        }

                        var dtBegin = detailForecast.DateTime.Date;
                        var dtEnd   = dtBegin.AddDays(1);
                        foreach (var itemdetail in forecastDetail.Items.Where(A => A.Date >= dtBegin && A.Date < dtEnd))
                        {
                            ViewModel.WeatherForecastDetail detail = new ViewModel.WeatherForecastDetail();
                            detail.DateTime = itemdetail.Date;
                            detail.Time     = itemdetail.Date.ToString("HH:mm");
                            detail.Icon     = WIWeather.IconTable[itemdetail.Icon];
                            detail.Temp     = string.Format("{0:0.0}°", itemdetail.Temp);
                            // TODO: MORE WEATHER INFO??

                            detailForecast.Details.Add(detail);
                        }

                        weather.ForecastDetails.Add(detailForecast);
                    }
                }

                if (weather.Forecasts.Count > 0)
                {
                    weather.Forecasts.RemoveAt(0);
                }
            }

            return(weather);
        }
 public void arrange()
 {
     _configuration = new Configuration.Configuration();
     _exampleBuilder = new ExampleArConfigurationBuilder<ElliottsSuperDuperRecordingAR>(_configuration);
 }
Exemplo n.º 21
0
 public static bool IsNotDevelopment()
 {
     IConfiguration configuration = new Configuration.Configuration();
       return configuration.GetEnvironment() != "Development";
 }
Exemplo n.º 22
0
 public MeekTestController(Configuration.Configuration config) : base(config)
 {
 }
Exemplo n.º 23
0
 protected virtual void ConfigureInterceptors(Configuration.Configuration configuration)
 {
 }
Exemplo n.º 24
0
 protected abstract void ConfigureDataObjectFactory(Configuration.Configuration configuration);
Exemplo n.º 25
0
 public FrmUI(Configuration.Configuration configuration)
 {
     InitializeComponent();
     InitializeUiFromConfig(configuration);
 }
Exemplo n.º 26
0
 public AudioTaskChain(Configuration.Configuration configuration)
     : base(configuration)
 {
 }
Exemplo n.º 27
0
        private void StartImport(Configuration.Configuration config)
        {
            // clean the plate
            TasksListView.Items.Clear();
            TasksListView.Groups.Clear();

            // build the configuration object and then the loader

            BulkLoader loader = BulkLoader.Create(config);


            // since we want to track progress of tasks, lets
            // get an aggregated list of tasks from the loader's jobs
            List <BulkCopyTask> tasks = new List <BulkCopyTask>();

            loader.Jobs.ForEach(j => j.Tasks.ForEach(tasks.Add));

            // add a list group for each site being loaded.
            // TODO: relocate targets to the loader
            config.Targets.ForEach(t => TasksListView.Groups.Add(new ListViewGroup(t.Name, t.Name)));

            // create the list items and event handler
            tasks.ForEach(t =>
            {
                ListViewItem item = new ListViewItem();

                item.SubItems.Add(t.Table);
                item.SubItems.Add("");
                item.SubItems.Add("");
                item.SubItems.Add("");

                TasksListView.Items.Add(item);
                item.Group = TasksListView.Groups[t.Site];

                t.RowsInserted += (ss, eee) => TasksListView.Invoke(() => UpdateTaskItem(t, item, eee));
            });


            // set up the import completion handler
            loader.Jobs.Complete += (ss, ee) => ImportButton.Invoke(() =>
            {
                ImportButton.Text    = "Import";
                ImportButton.Enabled = true;
                panel1.Enabled       = true;
                _timer.Stop();
                long count = loader.Jobs.Select(j => j.Tasks.Sum(t => t.Count)).Sum();


                StatusLabel.Text =
                    string.Format((_abort ? Resources.Rs_ImpAbort : Resources.Rs_ImpComplete) + "\r\n",
                                  count.ToString("#,##0"),
                                  _timer.ElapsedMilliseconds / 1000f / 60f);
            });


            // start the job

            _timer.Reset();
            _timer.Start();
            ImportButton.Text = "Abort";
            new Thread(() => loader.ProcessJobs(config)).Start();
        }
Exemplo n.º 28
0
 /// <summary>
 /// If using this method requires all information to be passed in
 /// </summary>
 public static void Initialize(Configuration.Configuration config)
 {
     Configure(config);
 }
Exemplo n.º 29
0
 public CachingConfiguration(Configuration.Configuration config)
 {
     _config = config;
 }
Exemplo n.º 30
0
        public void TestFixtureSetUp()
        {
            System = CreateSystem();
            var dbConfig = new Configuration.Configuration();
            dbConfig.SetValue("database.name", DatabaseName);

            #if PCL
            var dbPath = FileSystem.Local.CombinePath(".", DatabaseName);
            #else
            var dbPath = Path.Combine(Environment.CurrentDirectory, DatabaseName);
            #endif
            if (StorageType == StorageType.InMemory) {
                dbConfig.SetValue("database.storageSystem", DefaultStorageSystemNames.Heap);
            } else if (StorageType == StorageType.JournaledFile) {
                dbConfig.SetValue("database.storageSystem", DefaultStorageSystemNames.Journaled);
                dbConfig.SetValue("database.path", dbPath);
            } else if (StorageType == StorageType.SingleFile) {
                if (!FileSystem.Local.DirectoryExists(dbPath))
                    FileSystem.Local.CreateDirectory(dbPath);

                dbConfig.SetValue("database.storageSystem", DefaultStorageSystemNames.SingleFile);
                dbConfig.SetValue("database.basePath", dbPath);
            }

            DeleteFiles();

            Database = CreateDatabase(System, dbConfig);

            OnFixtureSetUp();
        }
Exemplo n.º 31
0
 public SQLiteInserter(Configuration.Configuration config)
     : base(config)
 {
 }
Exemplo n.º 32
0
 public MSSqlInserter(Configuration.Configuration config)
     : base(config)
 {
 }
Exemplo n.º 33
0
 public static IDatabaseContext CreateDatabaseContext(this ISystemContext context, string name)
 {
     var dbConfig = new Configuration.Configuration();
     dbConfig.SetValue("database.name", name);
     return context.CreateDatabaseContext(dbConfig);
 }
Exemplo n.º 34
0
 /**
  * @constructor
  * @param configuration - contains the configuration information for this application.
  * @param id - The ID of this ticket.
  */
 public Ticket(Configuration.Configuration configuration, string id)
 {
     ID = id;
 }
Exemplo n.º 35
0
 /// <inheritdoc />
 /// <summary>
 ///     Initializes a new instance of the <see cref="T:Jfevia.ProductivityShell.SolutionModel.SolutionEventArgs" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="profiles">The profiles.</param>
 /// <param name="selectedProfile">The selected profile.</param>
 public SolutionEventArgs(Configuration.Configuration configuration, ICollection <Profile> profiles, Profile selectedProfile)
 {
     Configuration   = configuration;
     Profiles        = profiles;
     SelectedProfile = selectedProfile;
 }
 /**
  * @constructor
  * @param configuration - Contains configuration information for this application.
  */
 public Database(Configuration.Configuration configuration)
 {
     _configuration = configuration;
 }
Exemplo n.º 37
0
 public void CreateNew()
 {
     var dbConfig = new Configuration.Configuration();
     dbConfig.SetValue("database.name", TestDbName);
     database = systemContext.CreateDatabase(dbConfig, TestAdminUser, TestAdminPass);
 }
Exemplo n.º 38
0
 public TestConfigProvider(Configuration.Configuration config)
 {
     config = _config;
 }
Exemplo n.º 39
0
        public ActionResult Index(SetupViewModel model)
        {
            if (ModelState.IsValid) {
                // Attempt to register the user
                MembershipCreateStatus createStatus = _membershipService.CreateUser(model.SetupModel.UserName, model.SetupModel.Password, model.SetupModel.Email);

                if (createStatus == MembershipCreateStatus.Success) {

                    _formsService.SignIn(model.SetupModel.UserName, false /* createPersistentCookie */);
                    // Create the site configuration
                    IConfiguration configuration = new Configuration.Configuration();
                    configuration.SiteName = model.Configuration.SiteName;
                    _session.Store(configuration);
                    _session.SaveChanges();

                    return RedirectToAction("index", "UI", new { area = "ui" });
                }

                ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));
            }
            // If we got this far, something failed, redisplay form
            return View(model);
        }
Exemplo n.º 40
0
        public async Task <object> ProcessData(Configuration.Configuration config)
        {
            List <CalendarItem> newCalendarItems = await _calendarFactory.GetFullCalendarList(config);

            var now = DateTime.Now;
            List <CalendarItem> filteredCalendarItems = new List <CalendarItem>();

            foreach (var item in newCalendarItems)
            {
                var dt = item.Start;

                if (now < dt)
                {
                    try
                    {
                        var nowDay      = new DateTime(now.Year, now.Month, now.Day);
                        var nowDayEnd   = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
                        var nowMonth    = new DateTime(now.Year, now.Month, 1);
                        var nowMonthEnd = new DateTime(now.Year, now.Month + 1, 1).AddSeconds(-1);
                        var nowYear     = new DateTime(now.Year, 1, 1);
                        var nowYearEnd  = new DateTime(now.Year + 1, 1, 1).AddSeconds(-1);
                        if (dt < now.AddMinutes(1))
                        {
                            item.Time = "Jetzt";
                        }
                        else if (dt < now.AddHours(1))
                        {
                            item.Time = string.Format("in {0} Minuten", (int)(dt - now).TotalMinutes);
                        }
                        else if (dt < now.AddHours(6) || dt < nowDayEnd)
                        {
                            item.Time = string.Format("in {0} Stunden", (int)(dt - now).TotalHours);
                        }
                        else if (dt < nowDayEnd.AddDays(1))
                        {
                            item.Time = string.Format("Morgen um {0:HH}:{0:mm}", dt);
                        }
                        else if (dt < nowDayEnd.AddDays(2))
                        {
                            item.Time = string.Format("Übermorgen um {0:HH}:{0:mm}", dt);
                        }
                        else if (dt < nowDayEnd.AddDays(6))
                        {
                            item.Time = string.Format("{0:dddd} um {0:HH}:{0:mm}", dt);
                        }
                        else if (dt < nowDayEnd.AddDays(15) || dt < nowMonthEnd)
                        {
                            item.Time = string.Format("in {0} Tagen", (int)(dt - nowDay).TotalDays);
                        }
                        else if (dt < nowMonthEnd.AddMonths(1))
                        {
                            item.Time = string.Format("nächsten Monat");
                        }
                        else if (dt < nowMonthEnd.AddMonths(6) || dt < nowYearEnd)
                        {
                            item.Time = string.Format("in {0} Monaten", nowYear.Year == dt.Year ? dt.Month - now.Month : 12 - now.Month + dt.Month);
                        }
                        else if (dt.Year - now.Year == 1)
                        {
                            item.Time = string.Format("nächstes Jahr im {0:MMMM}", dt);
                        }
                        else
                        {
                            item.Time = string.Format("in {0} Jahren", dt.Year - now.Year);
                        }


                        filteredCalendarItems.Add(item);
                    }
                    catch (Exception ex)
                    {
                        Log.e(ex);
                    }
                }
            }

            return(new List <CalendarItem>(filteredCalendarItems.Take(config.MaxCalendarItems)));
        }