Exemple #1
0
        public EngineViewModel(IEngine engine, IApplicationConfig config)
        {
            _engine        = engine;
            _engine.Config = _appConfig = config;

            Initialise(_engine);
        }
        public MenuViewModel(IApplicationState state, IPluginManager pluginManager, IApplicationConfig config, IPresetsManager presetManager)
        {
            _pluginManager  = pluginManager;
            _state          = state;
            _config         = config;
            _presetsManager = presetManager;

            //Commands
            _openCommand             = new DelegateCommand(Open);
            _openFileCommand         = new DelegateCommand(OpenFile);
            _openStreamCommand       = new DelegateCommand(OpenStream);
            _openDiscCommand         = new DelegateCommand(OpenDisc);
            _openDeviceCommand       = new DelegateCommand(OpenDevice);
            _openProcessCommand      = new DelegateCommand(OpenProcess);
            _browseSamplesCommand    = new DelegateCommand(BrowseSamples);
            _exitCommand             = new DelegateCommand(Exit);
            _changeFormatCommand     = new DelegateCommand(SetStereoInput);
            _changeProjectionCommand = new DelegateCommand(SetProjection);
            _changeEffectCommand     = new DelegateCommand(SetEffect);
            _changeLayoutCommand     = new DelegateCommand(SetStereoOutput);
            _changeDistortionCommand = new DelegateCommand(SetDistortion);
            _changeTrackerCommand    = new DelegateCommand(SetTracker);
            _saveMediaPresetCommand  = new DelegateCommand(SaveMediaPreset);
            _saveDevicePresetCommand = new DelegateCommand(SaveDevicePreset);
            _saveAllPresetCommand    = new DelegateCommand(SaveAllPreset);
            _loadMediaPresetCommand  = new DelegateCommand(LoadMediaPreset);
            _resetPresetCommand      = new DelegateCommand(ResetPreset);
            _settingsCommand         = new DelegateCommand(ShowSettings);
            _launchWebBrowserCommand = new DelegateCommand(LaunchWebBrowser);
            _aboutCommand            = new DelegateCommand(ShowAbout);
        }
Exemple #3
0
        public static LaunchResult Launch(IGameBundle bundle,
                                          string[] args, IApplicationConfig applicationConfig, string bindToIp, string levelLog)
        {
            StandaloneBundle = bundle;
            Config           = applicationConfig;
            _levelLog        = levelLog;
            _bindToIp        = bindToIp;

            var config     = BuildConfig();
            var serverTask = Task.Factory.StartNew(() => Bootstrap.Launch <Startup>(config));

            return(new LaunchResult
            {
                ServerTask = serverTask,
                ApiInitializationTask = Task <IGameServerApi> .Factory.StartNew(() =>
                {
                    while (serverTask.Status == TaskStatus.Running && Api == null)
                    {
                        Thread.Sleep(10);
                    }

                    if (Api == null)
                    {
                        throw new Exception("API not initialized");
                    }

                    return Api;
                })
            });
        }
Exemple #4
0
        public async Task ReadMessages <T>(IApplicationConfig config, Action <T> actionOnReceive)
        {
            var factory = new ConnectionFactory()
            {
                HostName = config.RabbitConnection
            };

            using (var connection = factory.CreateConnection())
            {
                using (var channel = connection.CreateModel())
                {
                    channel.QueueDeclare(queue: config.QueueName, durable: false, exclusive: false, autoDelete: false, arguments: null);

                    var consumer = new EventingBasicConsumer(channel);

                    consumer.Received += (model, ea) =>
                    {
                        var body    = ea.Body;
                        var message = JsonConvert.DeserializeObject <T>(Encoding.UTF8.GetString(body));
                        actionOnReceive.Invoke(message);
                    };


                    channel.BasicConsume(queue: config.QueueName,
                                         autoAck: true,
                                         consumer: consumer);

                    Console.ReadKey();
                }
            }
        }
Exemple #5
0
        public MenuViewModel(IApplicationState state, IPluginManager pluginManager, IApplicationConfig config, IPresetsManager presetManager)
        {
            _pluginManager = pluginManager;
            _state = state;
            _config = config;
            _presetsManager = presetManager;

            //Commands
            _openCommand = new DelegateCommand(Open);
            _openFileCommand = new DelegateCommand(OpenFile);
            _openStreamCommand = new DelegateCommand(OpenStream);
            _openDiscCommand = new DelegateCommand(OpenDisc);
            _openDeviceCommand = new DelegateCommand(OpenDevice);
            _openProcessCommand = new DelegateCommand(OpenProcess);
            _browseSamplesCommand = new DelegateCommand(BrowseSamples);
            _exitCommand = new DelegateCommand(Exit);
            _changeFormatCommand = new DelegateCommand(SetStereoInput);
            _changeProjectionCommand = new DelegateCommand(SetProjection);
            _changeEffectCommand = new DelegateCommand(SetEffect);
            _changeLayoutCommand = new DelegateCommand(SetStereoOutput);
            _changeDistortionCommand = new DelegateCommand(SetDistortion);
            _changeTrackerCommand = new DelegateCommand(SetTracker);
            _saveMediaPresetCommand = new DelegateCommand(SaveMediaPreset);
            _saveDevicePresetCommand = new DelegateCommand(SaveDevicePreset);
            _saveAllPresetCommand = new DelegateCommand(SaveAllPreset);
            _loadMediaPresetCommand = new DelegateCommand(LoadMediaPreset);
            _resetPresetCommand = new DelegateCommand(ResetPreset);
            _settingsCommand = new DelegateCommand(ShowSettings);
            _launchWebBrowserCommand = new DelegateCommand(LaunchWebBrowser);
            _aboutCommand = new DelegateCommand(ShowAbout);
        }
Exemple #6
0
 public SettingsManager(IApplicationState state, IPluginManager pluginManager, IApplicationConfig config, ApplicationSettingsBase settings)
 {
     _settings      = settings;
     _state         = state;
     _pluginManager = pluginManager;
     _config        = config;
 }
        public void PushMessage <T>(IApplicationConfig config, T message, string queueName)
        {
            try
            {
                var factory = new ConnectionFactory();

                factory.HostName = config.RabbitConnection;
                factory.Port     = config.RabbitConnectionPort;
                factory.UserName = config.RabbitConnectionUsername;
                factory.Password = config.RabbitConnectionPassword;

                using (var connection = factory.CreateConnection())
                    using (var channel = connection.CreateModel())
                    {
                        channel.QueueDeclare(queue: queueName, durable: false, exclusive: false, autoDelete: false, arguments: null);

                        var body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(message));

                        var properties = channel.CreateBasicProperties();
                        properties.Persistent = true;

                        channel.BasicPublish(exchange: "", routingKey: queueName, basicProperties: properties, body: body);
                    }
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to push message to Queue", ex);
            }
        }
Exemple #8
0
 public Config(IDatabaseConfig database, IApplicationConfig application, List<ICounterGroup> groups, List<ITag> tags)
 {
     _database = database;
     _application = application ?? new ApplicationConfig(10, false);
     _groups = groups;
     _tags = tags;
 }
 public Application(IInputQueue inputQueue, IOutputQueue outputQueue, IApplicationConfig applicationConfig)
 {
     inputQueue.Received     = this.HandleTask;
     this._outputQueue       = outputQueue;
     this._applicationConfig = applicationConfig;
     this._startEvent        = new ManualResetEvent(false);
 }
        public void Execute(object parameter)
        {
            // Select image
            string imagePath = SelectImageFile();

            if (String.IsNullOrEmpty(imagePath) || !File.Exists(imagePath))
            {
                return;
            }

            // Get current selected application and its paths.
            IApplicationConfig config = _addAppViewModel.Application;

            // Get application entry in set of all applications.
            var    appIconPathTuple     = _addAppViewModel.MainPageViewModel.Applications.First(x => x.ApplicationConfig.Equals(config));
            string applicationDirectory = Path.GetDirectoryName(appIconPathTuple.ApplicationConfigPath);

            string applicationIconFileName = Path.GetFileName(imagePath);
            string applicationIconPath     = Path.Combine(applicationDirectory, applicationIconFileName);

            // Copy image and set config file path.
            File.Copy(imagePath, applicationIconPath);
            config.AppIcon = applicationIconFileName;

            // No need to write file on disk, file will be updated by image.
            ImageSource source = new BitmapImage(new Uri(applicationIconPath, UriKind.Absolute));

            source.Freeze();
            appIconPathTuple.Image = source;
        }
 public SettingsManager(IApplicationState state, IPluginManager pluginManager, IApplicationConfig config, ApplicationSettingsBase settings)
 {
     _settings = settings;
     _state = state;
     _pluginManager = pluginManager;
     _config = config;
 }
 public FileProcessor(IFileDataModel fileDataModel, IFileUploadHelper fileUploadHelper, IApplicationConfig applicationConfig, IFileUploadHub fileUploadHub)
 {
     this._fileDataModel     = fileDataModel;
     this._fileUploadHelper  = fileUploadHelper;
     this._applicationConfig = applicationConfig;
     this._fileUploadHub     = fileUploadHub;
 }
Exemple #13
0
    /// <summary>
    /// Returns all mods for this application in load order.
    /// Note: Dependencies are not taken into account in load order - but the mod loader itself does reorder the list taking them into account.
    /// </summary>
    /// <param name="config">The application to get all mods for.</param>
    /// <param name="modifications">List of modifications to retrieve all mods from.</param>
    public static List <BooleanGenericTuple <PathTuple <ModConfig> > > GetAllMods(IApplicationConfig config, List <PathTuple <ModConfig> > modifications)
    {
        // Note: Must put items in top to bottom load order.
        var enabledModIds = config.EnabledMods;

        // Get dictionary of mods by Mod ID
        var modDictionary = new Dictionary <string, PathTuple <ModConfig> >();

        foreach (var mod in modifications)
        {
            modDictionary[mod.Config.ModId] = mod;
        }

        // Add enabled mods.
        var totalModList = new List <BooleanGenericTuple <PathTuple <ModConfig> > >(modifications.Count);

        foreach (var enabledModId in enabledModIds)
        {
            if (modDictionary.ContainsKey(enabledModId))
            {
                totalModList.Add(new BooleanGenericTuple <PathTuple <ModConfig> >(true, modDictionary[enabledModId]));
            }
        }

        // Add disabled mods.
        var enabledModIdSet = config.EnabledMods.ToHashSet();
        var disabledMods    = modifications.Where(x => !enabledModIdSet.Contains(x.Config.ModId));

        totalModList.AddRange(disabledMods.Select(x => new BooleanGenericTuple <PathTuple <ModConfig> >(false, x)));
        return(totalModList);
    }
        public void Initialise(IEngine engine, IApplicationConfig config, IApplicationContainer appContainer)
        {
            var defaultIcon  = "/AutoFileMover.Desktop;component/Images/AutoFileMover.ico";
            var errorIcon    = "/AutoFileMover.Desktop;component/Images/AutoFileMover_Error.ico";
            var progressIcon = "/AutoFileMover.Desktop;component/Images/AutoFileMover_InProgress.ico";

            _icon = Observable.Merge(Observable.FromEventPattern <EventHandler <FileEventArgs>, FileEventArgs>(h => engine.FileMoveStarted += h, h => engine.FileMoveStarted -= h).Select(e => progressIcon),
                                     Observable.FromEventPattern <EventHandler <FileMoveEventArgs>, FileMoveEventArgs>(h => engine.FileMoveProgress += h, h => engine.FileMoveProgress -= h).Select(e => progressIcon),
                                     Observable.FromEventPattern <EventHandler <FileEventArgs>, FileEventArgs>(h => engine.FileMoveCompleted        += h, h => engine.FileMoveCompleted -= h).Select(e => defaultIcon),
                                     Observable.FromEventPattern <EventHandler <FileErrorEventArgs>, FileErrorEventArgs>(h => engine.FileMoveError  += h, h => engine.FileMoveError -= h).Select(e => errorIcon),
                                     Observable.FromEventPattern <EventHandler <ErrorEventArgs>, ErrorEventArgs>(h => engine.Error += h, h => engine.Error -= h).Select(e => errorIcon))
                    .StartWith(defaultIcon)
                    .ToProperty(this, x => x.Icon);

            var fileOperations = Observable.FromEventPattern <EventHandler <FileEventArgs>, FileEventArgs>(h => engine.FileDetected += h, h => engine.FileDetected -= h)
                                 .Select(e => new FileOperationViewModel(e.EventArgs.OldFilePath, engine))
                                 .Distinct(fovm => fovm.OldFilePath)
                                 .CreateCollection();

            fileOperations.ChangeTrackingEnabled = true;

            FileOperations = fileOperations.CreateDerivedCollection(x => x, x => !(_appConfig.AutoClear && x.State == FileOperationState.Completed));

            ShowWindow = new ReactiveCommand();
            ShowWindow.Subscribe(_ => appContainer.ShowWindow());

            Exit = new ReactiveCommand();
            Exit.Subscribe(_ => appContainer.Exit());
        }
        public MmApplication(
            IShamanLogger logger,
            IApplicationConfig config,
            ISerializer serializer,
            ISocketFactory socketFactory,
            IMatchMaker matchMaker,
            IRequestSender requestSender,
            ITaskSchedulerFactory taskSchedulerFactory,
            IPacketSender packetSender,
            IShamanMessageSenderFactory messageSenderFactory,
            IMatchMakerServerInfoProvider serverProvider,
            IRoomManager roomManager, IMatchMakingGroupsManager matchMakingGroupManager, IPlayersManager playersManager, IMmMetrics mmMetrics, IProtectionManager protectionManager) : base(logger, config, serializer,
                                                                                                                                                                                            socketFactory, taskSchedulerFactory, requestSender, mmMetrics, protectionManager)
        {
            _packetSender            = packetSender;
            _messageSenderFactory    = messageSenderFactory;
            _serverProvider          = serverProvider;
            _roomManager             = roomManager;
            _matchMakingGroupManager = matchMakingGroupManager;
            _playersManager          = playersManager;
            _matchMaker = matchMaker;
            _id         = Guid.NewGuid();

            Logger?.Debug($"MmApplication constructor called. Id = {_id}");
        }
Exemple #16
0
 public UserService(IUserDBRepository userRepository,
                    IApplicationConfig applicationConfig,
                    IUserDigestService userDigestService)
 {
     _userRepository    = userRepository;
     _applicationConfig = applicationConfig;
     _userDigestService = userDigestService;
 }
Exemple #17
0
 public ChatHub(IApplicationConfig applicationConfig, ICacheHelper cacheHelper, IQueueDataModel queueDataModel,
                IAgentDataModel agentDataModel)
 {
     _applicationConfig = applicationConfig;
     _cacheHelper       = cacheHelper;
     _queueDataModel    = queueDataModel;
     _agentDataModel    = agentDataModel;
 }
Exemple #18
0
 public Config(List<IDatabaseConfig> databases, IApplicationConfig application, List<ICounterGroup> groups, List<ICounterPublisher> publishers, List<ITag> tags)
 {
     _databases = databases;
     _application = application ?? new ApplicationConfig(10, false, true, 20000);
     _groups = groups;
     _publishers = publishers;
     _tags = tags;
 }
 public ViewModelFactory(IApplicationConfig config, IPluginManager pluginManager, IApplicationState state, IPresetsManager presetsManager, IMediaService mediaService)
 {
     _config = config;
     _pluginManager = pluginManager;
     _state = state;
     _presetsManager = presetsManager;
     _mediaService = mediaService;
 }
Exemple #20
0
 public IndexModel(IDataService dataService,
                   SignInManager <RemotelyUser> signInManager,
                   IApplicationConfig appConfig)
 {
     _dataService   = dataService;
     _signInManager = signInManager;
     _appConfig     = appConfig;
 }
Exemple #21
0
 public UpdaterService(ILogger logger, IApplicationConfig appConfig, IFileCopyService fileCopyService, IDownloadService downloadService, IProcessManager processManager)
 {
     _logger          = logger;
     _appConfig       = appConfig;
     _fileCopyService = fileCopyService;
     _downloadService = downloadService;
     _processManager  = processManager;
 }
        public SettingsWindowViewModel(IApplicationState state, IApplicationConfig config, IPluginManager pluginManager)
        {
            _state = state;
            _config = config;
            _pluginManager = pluginManager;

            _changeSamplePathCommand = new DelegateCommand(ChangeSamplePath);
        }
Exemple #23
0
 public ViewModelFactory(IApplicationConfig config, IPluginManager pluginManager, IApplicationState state, IPresetsManager presetsManager, IMediaService mediaService)
 {
     _config         = config;
     _pluginManager  = pluginManager;
     _state          = state;
     _presetsManager = presetsManager;
     _mediaService   = mediaService;
 }
Exemple #24
0
        public SettingsWindowViewModel(IApplicationState state, IApplicationConfig config, IPluginManager pluginManager)
        {
            _state         = state;
            _config        = config;
            _pluginManager = pluginManager;

            _changeSamplePathCommand = new DelegateCommand(ChangeSamplePath);
        }
Exemple #25
0
 public AgentUpdateController(IWebHostEnvironment hostingEnv,
                              IDataService dataService,
                              IApplicationConfig appConfig)
 {
     HostEnv     = hostingEnv;
     DataService = dataService;
     AppConfig   = appConfig;
 }
        public TrayIconViewModel(IEngine engine, IApplicationConfig config, IApplicationContainer appContainer)
        {
            _engine       = engine;
            _appConfig    = config;
            _appContainer = appContainer;

            Initialise(_engine, _appConfig, _appContainer);
        }
 /// <summary>
 /// Checks the ID if it already exists and modifies the ID if it does so.
 /// </summary>
 private void UpdateIdIfDuplicate(IApplicationConfig config)
 {
     // Ensure no duplication of AppId
     while (_mainPageViewModel.Applications.Any(x => x.Config.AppId == config.AppId))
     {
         config.AppId += "_dup";
     }
 }
 /// <summary>
 /// Checks the ID if it already exists and modifies the ID if it does so.
 /// </summary>
 private void UpdateIdIfDuplicate(IApplicationConfig config)
 {
     // Ensure no duplication of AppId
     while (_configService.Items.Any(x => x.Config.AppId == config.AppId))
     {
         config.AppId += "_dup";
     }
 }
Exemple #29
0
 public Config(List <IDatabaseConfig> databases, IApplicationConfig application, List <ICounterGroup> groups, List <ICounterPublisher> publishers, List <ITag> tags)
 {
     _databases   = databases;
     _application = application ?? new ApplicationConfig(10, false, true, 20000);
     _groups      = groups;
     _publishers  = publishers;
     _tags        = tags;
 }
        public App()
        {
            try
            {
                var      applicationPath = new Uri(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase)).LocalPath;
                string[] pluginFolders   = { "Medias", "Effects", "Distortions", "Trackers", "Projections", "Stabilizers" };

                //Init services and inject dependancies
                _appConfig       = new AppSettingsApplicationConfig();
                _pluginManager   = new DynamicPluginManager(applicationPath, pluginFolders);
                _appState        = new DefaultApplicationState(_appConfig, _pluginManager);
                _settingsManager = new SettingsManager(_appState, _pluginManager, _appConfig, Settings.Default);
                _presetsManager  = new PresetsManager(_appConfig, _appState, _pluginManager);
                _mediaService    = new MediaService(_appState, _pluginManager, _presetsManager);

                ViewModelFactory = new ViewModelFactory(_appConfig, _pluginManager, _appState, _presetsManager,
                                                        _mediaService);

                //Проверка лицензии ассинхронно, чтобы не задерживать движения - на коленке сделано
                //Task.Factory.StartNew(() =>
                //{
                //    try
                //    {
                //        if (File.Exists("Vr.lic") == false)
                //        {

                //            throw new VrLicenseException("Файл лицензии не найден!");
                //        }

                //        using (StreamReader sr = new StreamReader("Vr.lic"))
                //        {
                //            LicenseProvider licenseProvider = new LicenseProvider();
                //            var licese = licenseProvider.GetLicenseValue();
                //            String line = sr.ReadToEnd();
                //            if (licese.Equals(line) == false)
                //            {
                //                throw new VrLicenseException("Неверный файл лицензии!");
                //            }
                //        }
                //    }
                //    catch (Exception e)
                //    {

                //        Logger.Instance.Error("Error while initializing application.", e);
                //        Environment.Exit(1);
                //    }
                //});
            }
            //catch (Exception le)
            //{
            //    MessageBox.Show(le.Message);
            //    Application.Current.Shutdown(-1);
            //}
            catch (Exception exc)
            {
                Logger.Instance.Error("Error while initializing application.", exc);
            }
        }
 public FileController(IFileDataModel fileDataModel, ILogger logger, IMessageQueueHelper messageQueueHelper, IApplicationConfig applicationConfig, IFileUploadHelper fileUploadHelper, IGenericHelper genericHelper)
 {
     this._fileDataModel      = fileDataModel;
     this._logger             = logger;
     this._messageQueueHelper = messageQueueHelper;
     this._applicationConfig  = applicationConfig;
     this._fileUploadHelper   = fileUploadHelper;
     this._genericHelper      = genericHelper;
 }
Exemple #32
0
 public GameToMmServerActualizer(IRequestSender requestSender, ITaskSchedulerFactory taskSchedulerFactory, IStatisticsProvider statsProvider, IApplicationConfig config, IShamanLogger logger, IMatchMakerInfoProvider matchMakerInfoProvider)
 {
     _requestSender          = requestSender;
     _taskScheduler          = taskSchedulerFactory.GetTaskScheduler();
     _statsProvider          = statsProvider;
     _logger                 = logger;
     _matchMakerInfoProvider = matchMakerInfoProvider;
     _config                 = config;
 }
Exemple #33
0
 private void GetConfig(XPathNavigator nav)
 {
     _application = new ApplicationConfig(GetChild(nav, "application"), null);
     _constants   = new ConstantsConfig(GetChild(nav, "constants"), null);
     _encryption  = new EncryptionConfig(GetChild(nav, "encryption"), null);
     _email       = new EmailConfig(GetChild(nav, "email"), null);
     _user        = new UserConfig(GetChild(nav, "user"), null);
     _environment = new EnvironmentConfig(GetChild(nav, "environment"), null);
 }
Exemple #34
0
 public TheopenemController(IDataService dataService,
                            UserManager <RemotelyUser> userManager,
                            IEmailSenderEx emailSender,
                            IApplicationConfig appConfig)
 {
     DataService = dataService;
     UserManager = userManager;
     AppConfig   = appConfig;
 }
Exemple #35
0
 public DataService(ApplicationDbContext context,
                    IApplicationConfig appConfig,
                    IHostEnvironment hostEnvironment,
                    UserManager <RemotelyUser> userManager)
 {
     RemotelyContext = context;
     AppConfig       = appConfig;
     HostEnvironment = hostEnvironment;
     UserManager     = userManager;
 }
 public RemoteControlController(IDataService dataService,
                                IHubContext <AgentHub> agentHub,
                                IApplicationConfig appConfig,
                                SignInManager <RemotelyUser> signInManager)
 {
     DataService     = dataService;
     AgentHubContext = agentHub;
     AppConfig       = appConfig;
     SignInManager   = signInManager;
 }
        public ViewPortViewModel(IApplicationState state, IApplicationConfig config)
        {
            _state = state;
            _config = config;

            //Commands
            _toggleNavigationCommand = new RelayCommand(ToggleNavigation);

            State.PropertyChanged += State_PropertyChanged;
            State.StereoOutput = State.StereoOutput;//Force refresh
        }
        public MainWindowViewModel(IApplicationState state, IApplicationConfig config, IMediaService mediaService)
        {
            _state = state;
            _config = config;
            _mediaService = mediaService;

            _state.PropertyChanged += ChangeShortcutsMapping;
            _config.PropertyChanged += ChangeShortcutsMapping;

            ChangeShortcutsMapping(null, new PropertyChangedEventArgs("Keys"));

            //Commands
            _keyBoardCommand = new RelayCommand(ExecuteShortcut);
        }
        public DefaultApplicationState(IApplicationConfig config, IPluginManager pluginManager)
        {
            //Set plugins
            MediaPlugin = pluginManager.Medias
                .Where(m => m.GetType().FullName.Contains(config.DefaultMedia))
                .DefaultIfEmpty(pluginManager.Medias.FirstOrDefault())
                .First();

            EffectPlugin = pluginManager.Effects
                .Where(e => e.GetType().FullName.Contains(config.DefaultEffect))
                .DefaultIfEmpty(pluginManager.Effects.FirstOrDefault())
                .First();

            DistortionPlugin = pluginManager.Distortions
                .Where(d => d.GetType().FullName.Contains(config.DefaultDistortion))
                .DefaultIfEmpty(pluginManager.Distortions.FirstOrDefault())
                .First();

            ProjectionPlugin = pluginManager.Projections
                .Where(p => p.GetType().FullName.Contains(config.DefaultProjection))
                .DefaultIfEmpty(pluginManager.Projections.FirstOrDefault())
                .First();

            TrackerPlugin = pluginManager.Trackers
                .Where(t => t.GetType().FullName.Contains(config.DefaultTracker))
                .DefaultIfEmpty(pluginManager.Trackers.FirstOrDefault())
                .First();

            StabilizerPlugin = pluginManager.Stabilizers
                .Where(s => s.GetType().FullName.Contains(config.DefaultStabilizer))
                .DefaultIfEmpty(pluginManager.Stabilizers.FirstOrDefault())
                .First();

            Shortcuts = new ShortcutsManager();

            //Todo: Use binding instead of a timer
            var timer = new DispatcherTimer(DispatcherPriority.Render);
            timer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            timer.Tick += TimerOnTick;
            timer.Start();
        }
Exemple #40
0
 private App()
 {
     try
     {
         var applicationPath = new Uri(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase)).LocalPath;
         string[] pluginFolders = { "Medias", "Effects", "Distortions", "Trackers", "Projections", "Stabilizers" };
     
         //Init services and inject dependancies
         _appConfig = new AppSettingsApplicationConfig();
         _pluginManager = new DynamicPluginManager(applicationPath, pluginFolders);
         _appState = new DefaultApplicationState(_appConfig, _pluginManager);
         _settingsManager = new SettingsManager(_appState, _pluginManager, _appConfig, Settings.Default);
         _mediaService = new MediaService(_appState, _pluginManager);
         _presetsManager = new PresetsManager(_appConfig, _appState, _pluginManager);
         
         ViewModelFactory = new ViewModelFactory(_appConfig, _pluginManager, _appState, _presetsManager, _mediaService);
     }
     catch (Exception exc)
     {
         Logger.Instance.Error("Error while initializing application.", exc);
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;
            myTracker = new OculusRiftTracker();
            this.myTracker.Load();

            this._state = new DefaultApplicationState();
            this._config = new ApplicationConfigBase();

            this.updateTime = new DispatcherTimer();
            this.updateTime.Interval = TimeSpan.FromMilliseconds(0.5);
            this.updateTime.Tick += new EventHandler(update);
            this.updateTime.Start();

            this.myTracker.Calibrate();

            this.myGamepad = new GamepadState(0);

            IPAddress ip = IPAddress.Parse("192.168.0.100");
            IPEndPoint ipEnd = new IPEndPoint(ip, 4242);
            ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            ClientSocket.Connect(ipEnd);
        }
Exemple #42
0
 public DomainConfig(IApplicationConfig config)
 {
     this.config = config;
 }
Exemple #43
0
 public PresetsManager(IApplicationConfig config, IApplicationState state, IPluginManager pluginManager)
 {
     _config = config;
     _state = state;
     _pluginManager = pluginManager;
 }