Esempio n. 1
0
        public RootViewModel(
            IKernel kernel,
            IEventAggregator eventAggregator,
            ISettingsService settingsService,
            ICoreService coreService,
            IWindowManager windowManager,
            IDebugService debugService,
            IRegistrationService builtInRegistrationService,
            IMessageService messageService,
            SidebarViewModel sidebarViewModel)
        {
            _kernel                     = kernel;
            _eventAggregator            = eventAggregator;
            _settingsService            = settingsService;
            _coreService                = coreService;
            _windowManager              = windowManager;
            _debugService               = debugService;
            _builtInRegistrationService = builtInRegistrationService;
            _messageService             = messageService;
            _sidebarViewModel           = sidebarViewModel;
            _frameTimeUpdateTimer       = new Timer(500);

            _windowSize = _settingsService.GetSetting <WindowSize>("UI.RootWindowSize");
            _sidebarViewModel.ConductWith(this);

            ActiveItem      = sidebarViewModel.SelectedItem;
            ActiveItemReady = true;
            PinSidebar      = _settingsService.GetSetting("UI.PinSidebar", false);

            AssemblyInformationalVersionAttribute versionAttribute = typeof(RootViewModel).Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>();

            WindowTitle = $"Artemis {versionAttribute?.InformationalVersion} build {Constants.BuildInfo.BuildNumberDisplay}";
        }
 public OrcaCoreService()
 {
     // from here, everything Autofac.
     // IntelliTrader code:
     // TODO: IServiceCollection.
     _coreService = Application.Resolve<ICoreService>();
 }
Esempio n. 3
0
 public BaseController(ICoreService <T> coreService)
 {
     UnitOfWork  = coreService.UnitOfWork;
     Logger      = coreService.Logger;
     Mapper      = coreService.Mapper;
     CoreService = coreService;
 }
Esempio n. 4
0
 public MemberController(ICoreService <Comment> com, ICoreService <Product> prd, ICoreService <Post> post, ICoreService <Tag> tag)
 {
     _com  = com;
     _prd  = prd;
     _post = post;
     _tag  = tag;
 }
        public SurfaceEditorViewModel(IRgbService rgbService,
                                      ICoreService coreService,
                                      IDialogService dialogService,
                                      ISettingsService settingsService,
                                      IDeviceService deviceService,
                                      IWindowManager windowManager,
                                      IDeviceDebugVmFactory deviceDebugVmFactory)
        {
            DisplayName        = "Surface Editor";
            SelectionRectangle = new RectangleGeometry();
            PanZoomViewModel   = new PanZoomViewModel();
            Cursor             = null;
            ColorDevices       = true;

            SurfaceDeviceViewModels = new BindableCollection <SurfaceDeviceViewModel>();
            ListDeviceViewModels    = new BindableCollection <ListDeviceViewModel>();

            _rgbService           = rgbService;
            _coreService          = coreService;
            _dialogService        = dialogService;
            _settingsService      = settingsService;
            _deviceService        = deviceService;
            _windowManager        = windowManager;
            _deviceDebugVmFactory = deviceDebugVmFactory;
        }
Esempio n. 6
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 /// <param name="info"></param>
 /// <param name="auto"></param>
 public SyncDataWindow(ICoreService service, UserInfo info, bool auto)
     : base(service)
 {
     this.userInfo = info;
     this.auto = auto;
     InitializeComponent();
 }
    public CoreServiceManager()
    {
        Debug.Assert(Instance == null);
        Instance = this;

        CoreServiceBank bank = CoreServiceBank.LoadBank();

        // Spawn core services
        List <ICoreService> unofficialServiceList = bank.GetCoreServices();

        foreach (ICoreService service in unofficialServiceList)
        {
            ICoreService officialInstance = service.ProvideOfficialInstance();
            _services.Add(officialInstance.GetType(), officialInstance);
        }

        // Initialize them all
        ServiceInitJoin join = new ServiceInitJoin(this, OnInitializationComplete);

        foreach (KeyValuePair <Type, ICoreService> servicePair in _services)
        {
            servicePair.Value.Initialize(join.RegisterOperation());
        }
        join.MarkEnd();
    }
Esempio n. 8
0
 protected BaseController(ICoreService <T> coreService)
 {
     CoreService  = coreService;
     UnitOfWork   = coreService.UnitOfWork;
     Logger       = coreService.Logger;
     FileProvider = coreService.FileProvider;
 }
        public TransactionsModule(ICoreService service)
            : base("/transactions")
        {
            Get["/"] = parameters =>
            {
                if (Request.Query.since)
                {
                    return View["Transactions", service.GetTransactions(Request.Query.since)];
                }

                return View["Transactions", service.GetTransactions()];
            };

            Get["/{token}"] = parameters =>
            {
                var transaction = service.GetTransaction(parameters.token);

                return View["Transaction", transaction];
            };

            Get["/{token}/transcript"] = parameters =>
            {
                var transcript = service.GetTransactionTranscript(parameters.token);

                return View["TransactionTranscript", transcript];
            };
        }
 public GameProcessStartEventArgs(ICoreService eventCoreInstance, IGameInfo gameInfo, IEmulatorAssembly emulatorAssembly, IEmulatorBridge emulatorBridge, Process process)
     : base(eventCoreInstance, gameInfo)
 {
     this.GameEmulatorAssembly = emulatorAssembly;
     this.GameEmulatorBridge = this.GameEmulatorBridge;
     this.GameEmulatorProcess = this.GameEmulatorProcess;
 }
Esempio n. 11
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 /// <param name="items"></param>
 public WorkUploadWindow(ICoreService service, FileUploadItems items)
     : base(service)
 {
     this.StartPosition = FormStartPosition.CenterScreen;
     InitializeComponent();
     this.fileUploadItems = items;
 }
Esempio n. 12
0
        public SettingsViewModel Settings(SaveSettingsRequest model)
        {
            if (!Application.Resolve <ICoreService>().Config.ReadOnlyMode)
            {
                ICoreService    coreService    = Application.Resolve <ICoreService>();
                ITradingService tradingService = Application.Resolve <ITradingService>();

                coreService.Config.HealthCheckEnabled = model.HealthCheckEnabled;
                tradingService.Config.BuyEnabled      = model.BuyEnabled;
                tradingService.Config.BuyDCAEnabled   = model.BuyDCAEnabled;
                tradingService.Config.SellEnabled     = model.SellEnabled;

                if (model.TradingSuspended)
                {
                    tradingService.SuspendTrading();
                }
                else
                {
                    tradingService.ResumeTrading();
                }
                return(this.Settings());
            }
            else
            {
                return(this.Settings());
            }
        }
Esempio n. 13
0
        public static ICoreService GetClient(Environment environment)
        {
            Uri cmUri = new Uri(environment.CMSUrl);

            if (_clientInstance == null)
            {
                var binding = GetBinding(cmUri.Scheme == "https");

                var endpoint = _version;
                CoreServiceClient coreServiceClient = new CoreServiceClient((Binding)binding,
                                                                            new EndpointAddress($"{cmUri.Scheme}://{cmUri.Host}:{cmUri.Port}/webservices/CoreService{_version}.svc/basicHttp"));
                if (!string.IsNullOrEmpty(environment.Username) && !string.IsNullOrEmpty(environment.Password))
                {
                    ((ClientBase <ICoreService>)coreServiceClient).ClientCredentials.Windows.ClientCredential.UserName = environment.Username;
                    ((ClientBase <ICoreService>)coreServiceClient).ClientCredentials.Windows.ClientCredential.Password = environment.Password;
                }
                if (!string.IsNullOrEmpty(environment.UserDomain))
                {
                    ((ClientBase <ICoreService>)coreServiceClient).ClientCredentials.Windows.ClientCredential.Domain = string.IsNullOrEmpty(environment.UserDomain) ? "." : environment.UserDomain;
                }

                _clientInstance = coreServiceClient;
            }
            return(_clientInstance);
        }
Esempio n. 14
0
        private void OpenHttpsConnection(NetworkCredential credentials, EndpointAddress endpointAddress)
        {
            var binding = new BasicHttpsBinding()
            {
                MaxBufferSize          = int.MaxValue,
                MaxBufferPoolSize      = int.MaxValue,
                MaxReceivedMessageSize = int.MaxValue,
                ReaderQuotas           = new System.Xml.XmlDictionaryReaderQuotas()
                {
                    MaxStringContentLength = int.MaxValue,
                    MaxArrayLength         = int.MaxValue,
                },
                Security = new BasicHttpsSecurity()
                {
                    Mode      = BasicHttpsSecurityMode.Transport,
                    Transport = new HttpTransportSecurity()
                    {
                        ClientCredentialType = HttpClientCredentialType.Basic
                    }
                }
            };

            ChannelFactory <ICoreService> factory = new ChannelFactory <ICoreService>(binding, endpointAddress);

            var credentialBehaviour = factory.Endpoint.Behaviors.Find <System.ServiceModel.Description.ClientCredentials>();

            credentialBehaviour.UserName.UserName = credentials.UserName;
            credentialBehaviour.UserName.Password = credentials.Password;

            _client  = factory.CreateChannel();
            _factory = factory;
        }
Esempio n. 15
0
        public ImageProcessorService(IConfigService configService, ICoreService coreService)
        {
            _configService = configService;
            _coreService   = coreService;

            BackgroundBitmap = new Bitmap(_configService.DeviceConfig.PixelWidth, _configService.DeviceConfig.PixelHeight);
        }
 public ModifyConfigurationFlagEventArgs(ICoreService eventCoreInstance, object previousFlagValue, object modifiedFlagValue, IConfigurationFlag configurationFlag)
     : base(eventCoreInstance)
 {
     this.PreviousFlagValue = previousFlagValue;
     this.ModifiedFlagValue = modifiedFlagValue;
     this.ConfigurationFlag = configurationFlag;
 }
 public HomeController(ICoreService <Post> _ps, ICoreService <Image> _img, ICoreService <Tag> _tag, ICoreService <User> _us)
 {
     ps  = _ps;
     img = _img;
     tag = _tag;
     us  = _us;
 }
 public OutpatientController(ICoreService core, IOutpatientService outpatient, IPatientService patient, IConceptService concept)
 {
     ICoreService       = core;
     IPatientService    = patient;
     IConceptService    = concept;
     IOutpatientService = outpatient;
 }
 public SubAreaController(ICoreService <SubAreaController> coreService,
                          ISubAreaRepository subAreaRepository,
                          IVehicleRepository vehicleRepository) : base(coreService)
 {
     _subAreaRepository = subAreaRepository;
     _vehicleRepository = vehicleRepository;
 }
Esempio n. 20
0
        public LayerPropertiesViewModel(IProfileEditorService profileEditorService,
                                        ICoreService coreService,
                                        ISettingsService settingsService,
                                        ILayerPropertyVmFactory layerPropertyVmFactory,
                                        DataBindingsViewModel dataBindingsViewModel)
        {
            _layerPropertyVmFactory = layerPropertyVmFactory;

            ProfileEditorService = profileEditorService;
            CoreService          = coreService;
            SettingsService      = settingsService;

            PropertyChanged += HandlePropertyTreeIndexChanged;

            // Left side
            TreeViewModel = _layerPropertyVmFactory.TreeViewModel(this, Items);
            TreeViewModel.ConductWith(this);
            EffectsViewModel = _layerPropertyVmFactory.EffectsViewModel(this);
            EffectsViewModel.ConductWith(this);

            // Right side
            StartTimelineSegmentViewModel = _layerPropertyVmFactory.TimelineSegmentViewModel(SegmentViewModelType.Start, Items);
            StartTimelineSegmentViewModel.ConductWith(this);
            MainTimelineSegmentViewModel = _layerPropertyVmFactory.TimelineSegmentViewModel(SegmentViewModelType.Main, Items);
            MainTimelineSegmentViewModel.ConductWith(this);
            EndTimelineSegmentViewModel = _layerPropertyVmFactory.TimelineSegmentViewModel(SegmentViewModelType.End, Items);
            EndTimelineSegmentViewModel.ConductWith(this);
            TimelineViewModel = _layerPropertyVmFactory.TimelineViewModel(this, Items);
            TimelineViewModel.ConductWith(this);
            DataBindingsViewModel = dataBindingsViewModel;
            DataBindingsViewModel.ConductWith(this);
        }
Esempio n. 21
0
        public LayerPropertiesViewModel(IProfileEditorService profileEditorService,
                                        ICoreService coreService,
                                        ISettingsService settingsService,
                                        ILayerPropertyVmFactory layerPropertyVmFactory,
                                        DataBindingsViewModel dataBindingsViewModel)
        {
            _layerPropertyVmFactory = layerPropertyVmFactory;

            ProfileEditorService = profileEditorService;
            CoreService          = coreService;
            SettingsService      = settingsService;

            LayerPropertyGroups = new BindableCollection <LayerPropertyGroupViewModel>();
            PropertyChanged    += HandlePropertyTreeIndexChanged;

            // Left side
            TreeViewModel    = _layerPropertyVmFactory.TreeViewModel(this, LayerPropertyGroups);
            EffectsViewModel = _layerPropertyVmFactory.EffectsViewModel(this);
            Items.Add(TreeViewModel);
            Items.Add(EffectsViewModel);

            // Right side
            StartTimelineSegmentViewModel = _layerPropertyVmFactory.TimelineSegmentViewModel(SegmentViewModelType.Start, LayerPropertyGroups);
            MainTimelineSegmentViewModel  = _layerPropertyVmFactory.TimelineSegmentViewModel(SegmentViewModelType.Main, LayerPropertyGroups);
            EndTimelineSegmentViewModel   = _layerPropertyVmFactory.TimelineSegmentViewModel(SegmentViewModelType.End, LayerPropertyGroups);
            TimelineViewModel             = _layerPropertyVmFactory.TimelineViewModel(this, LayerPropertyGroups);
            DataBindingsViewModel         = dataBindingsViewModel;
            Items.Add(StartTimelineSegmentViewModel);
            Items.Add(MainTimelineSegmentViewModel);
            Items.Add(EndTimelineSegmentViewModel);
            Items.Add(TimelineViewModel);
            Items.Add(DataBindingsViewModel);
        }
Esempio n. 22
0
 public TemplateCollector(IGeneratorConfiguration config)
 {
     log = LogManager.GetLogger(this.GetType());
     Logger.Setup(config);
     log.Debug("started SchemaCollector");
     Client = CoreserviceClientFactory.GetClient();
 }
Esempio n. 23
0
        public DeviceDialogViewModel(ArtemisDevice device,
                                     ICoreService coreService,
                                     IDeviceService deviceService,
                                     IRgbService rgbService,
                                     IDialogService dialogService,
                                     IDeviceDebugVmFactory factory)
        {
            _coreService   = coreService;
            _deviceService = deviceService;
            _rgbService    = rgbService;
            _dialogService = dialogService;

            Device           = device;
            PanZoomViewModel = new PanZoomViewModel();
            SelectedLeds     = new BindableCollection <ArtemisLed>();

            Items.Add(factory.DevicePropertiesTabViewModel(device));
            if (device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Keyboard)
            {
                Items.Add(factory.InputMappingsTabViewModel(device));
            }
            Items.Add(factory.DeviceInfoTabViewModel(device));
            Items.Add(factory.DeviceLedsTabViewModel(device));

            ActiveItem  = Items.First();
            DisplayName = $"{device.RgbDevice.DeviceInfo.Model} | Artemis";
        }
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 /// <param name="store"></param>
 /// <param name="studentIDs"></param>
 public WorkUploadToServer(ICoreService service, LocalStudentWorkStore store,string[] studentIDs)
     : base(service)
 {
     this.Store = store;
     InitializeComponent();
     this.LoadControls(studentIDs);
 }
Esempio n. 25
0
        public RegistrationService(ILogger logger,
                                   ICoreService coreService,
                                   IDataModelUIService dataModelUIService,
                                   IProfileEditorService profileEditorService,
                                   IPluginManagementService pluginManagementService,
                                   IInputService inputService,
                                   IMessageService messageService,
                                   IWebServerService webServerService,
                                   IRgbService rgbService,
                                   ISettingsService settingsService)
        {
            _logger                  = logger;
            _coreService             = coreService;
            _dataModelUIService      = dataModelUIService;
            _profileEditorService    = profileEditorService;
            _pluginManagementService = pluginManagementService;
            _inputService            = inputService;
            _messageService          = messageService;
            _webServerService        = webServerService;
            _rgbService              = rgbService;
            _settingsService         = settingsService;

            LoadPluginModules();
            pluginManagementService.PluginEnabling += PluginServiceOnPluginEnabling;
        }
Esempio n. 26
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 public UCLogin(ICoreService service, EnumLoginMethod method, Students students)
     : base(service)
 {
     this.loginMethod = method;
     this.students = students;
     InitializeComponent();
 }
Esempio n. 27
0
 public HomeController(ICoreService <Post> ps, ICoreService <Category> cs, ICoreService <User> us, ICoreService <Comment> cms)
 {
     _ps  = ps;
     _cs  = cs;
     _cms = cms;
     _us  = us;
 }
 public GameResultsScrapedEventArgs(ICoreService eventCoreInstance, string gameFileName, IList<IGameScrapeResult> scrapedResults, IScraper scraper)
     : base(eventCoreInstance)
 {
     this.GameFileName = gameFileName;
     this.ScrapedResults = scrapedResults;
     this.GameScraper = scraper;
 }
        public GeneralSettingsTabViewModel(
            IKernel kernel,
            IWindowManager windowManager,
            IDialogService dialogService,
            IDebugService debugService,
            ISettingsService settingsService,
            IUpdateService updateService,
            IPluginManagementService pluginManagementService,
            IMessageService messageService,
            IRegistrationService registrationService,
            ICoreService coreService
            )
        {
            DisplayName = "GENERAL";

            _kernel              = kernel;
            _windowManager       = windowManager;
            _dialogService       = dialogService;
            _debugService        = debugService;
            _settingsService     = settingsService;
            _updateService       = updateService;
            _messageService      = messageService;
            _registrationService = registrationService;

            LogLevels    = new BindableCollection <ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(LogEventLevel)));
            ColorSchemes = new BindableCollection <ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(ApplicationColorScheme)));
            RenderScales = new List <Tuple <string, double> >
            {
                new("25%", 0.25),
                new("50%", 0.5),
                new("100%", 1),
            };
Esempio n. 30
0
        public TrayViewModel(IKernel kernel,
                             IWindowManager windowManager,
                             IWindowService windowService,
                             IMessageService messageService,
                             IUpdateService updateService,
                             IEventAggregator eventAggregator,
                             ICoreService coreService,
                             IDebugService debugService,
                             ISettingsService settingsService)
        {
            _kernel          = kernel;
            _windowManager   = windowManager;
            _eventAggregator = eventAggregator;
            _debugService    = debugService;

            Core.Utilities.ShutdownRequested += UtilitiesOnShutdownRequested;
            Core.Utilities.RestartRequested  += UtilitiesOnShutdownRequested;

            windowService.ConfigureMainWindowProvider(this);
            messageService.ConfigureNotificationProvider(this);
            bool autoRunning   = Bootstrapper.StartupArguments.Contains("--autorun");
            bool minimized     = Bootstrapper.StartupArguments.Contains("--minimized");
            bool showOnAutoRun = settingsService.GetSetting("UI.ShowOnStartup", true).Value;

            if (autoRunning && !showOnAutoRun || minimized)
            {
                coreService.Initialized += (_, _) => updateService.AutoUpdate();
            }
            else
            {
                ShowSplashScreen();
                coreService.Initialized += (_, _) => TrayBringToForeground();
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="service"></param>
 /// <param name="store"></param>
 /// <param name="students"></param>
 public BatchUploadWaitWindow(ICoreService service, LocalStudentWorkStore store, LocalStudents students)
     : base(service)
 {
     this.store = store;
     this.students = students;
     InitializeComponent();
 }
Esempio n. 32
0
        public RootViewModel(
            IEventAggregator eventAggregator,
            ISettingsService settingsService,
            ICoreService coreService,
            IDebugService debugService,
            IRegistrationService builtInRegistrationService,
            ISnackbarMessageQueue snackbarMessageQueue,
            SidebarViewModel sidebarViewModel)
        {
            SidebarViewModel            = sidebarViewModel;
            _eventAggregator            = eventAggregator;
            _coreService                = coreService;
            _debugService               = debugService;
            _builtInRegistrationService = builtInRegistrationService;
            _snackbarMessageQueue       = snackbarMessageQueue;

            _frameTimeUpdateTimer = new Timer(500);

            _colorScheme = settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic);
            _windowSize  = settingsService.GetSetting <WindowSize>("UI.RootWindowSize");

            _themeWatcher = new ThemeWatcher();
            ApplyColorSchemeSetting();

            ActiveItem      = SidebarViewModel.SelectedItem;
            ActiveItemReady = true;

            AssemblyInformationalVersionAttribute?versionAttribute = typeof(RootViewModel).Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>();

            WindowTitle = $"Artemis {versionAttribute?.InformationalVersion}";
        }
Esempio n. 33
0
        private void OpenHttpConnection(NetworkCredential credentials, EndpointAddress endpointAddress)
        {
            var binding = new BasicHttpBinding()
            {
                MaxBufferSize          = int.MaxValue,
                MaxBufferPoolSize      = int.MaxValue,
                MaxReceivedMessageSize = int.MaxValue,
                ReaderQuotas           = new System.Xml.XmlDictionaryReaderQuotas()
                {
                    MaxStringContentLength = int.MaxValue,
                    MaxArrayLength         = int.MaxValue,
                },
                Security = new BasicHttpSecurity()
                {
                    Mode      = BasicHttpSecurityMode.TransportCredentialOnly,
                    Transport = new HttpTransportSecurity()
                    {
                        ClientCredentialType = HttpClientCredentialType.Windows,
                    }
                }
            };

            ChannelFactory <ICoreService> factory = new ChannelFactory <ICoreService>(binding, endpointAddress);

            factory.Credentials.Windows.ClientCredential = credentials;

            _client  = factory.CreateChannel();
            _factory = factory;
        }
Esempio n. 34
0
        public SettingsViewModel Settings()
        {
            ICoreService coreService = Application.Resolve <ICoreService>();

            ITradingService tradingService = Application.Resolve <ITradingService>();
            IEnumerable <IConfigurableService> allConfigurableServices = Application.Resolve <IEnumerable <IConfigurableService> >();

            var model = new SettingsViewModel()
            {
                InstanceName       = coreService.Config.InstanceName,
                Version            = coreService.Version,
                ReadOnlyMode       = coreService.Config.ReadOnlyMode,
                BuyEnabled         = tradingService.Config.BuyEnabled,
                BuyDCAEnabled      = tradingService.Config.BuyDCAEnabled,
                SellEnabled        = tradingService.Config.SellEnabled,
                TradingSuspended   = tradingService.IsTradingSuspended,
                HealthCheckEnabled = coreService.Config.HealthCheckEnabled,
                Configs            = allConfigurableServices
                                     .Where(s => !s.GetType().Name.Contains(Constants.ServiceNames.BacktestingService))
                                     .OrderBy(s => s.ServiceName)
                                     .ToDictionary(s => s.ServiceName, s => Application.ConfigProvider.GetSectionJson(s.ServiceName))
            };

            return(model);
        }
Esempio n. 35
0
 // Interesting thing happens here: Unity injects components created
 // by both MEF and Unity
 public CoreComponent(
     [Dependency("MefService3")] IMefService mefService3,
     ICoreService coreService)
 {
     m_MefService3 = mefService3;
     m_CoreService = coreService;
 }
Esempio n. 36
0
 // Interesting thing happens here: Unity injects components created
 // by both MEF and Unity
 public CoreComponent(
     [Dependency("MefService3")] IMefService mefService3,
     ICoreService coreService)
 {
     m_MefService3 = mefService3;
     m_CoreService = coreService;
 }
Esempio n. 37
0
 protected SalesController(ICoreService <T> coreService)
 {
     CoreService = coreService;
     UnitOfWork  = coreService.UnitOfWork;
     Logger      = coreService.Logger;
     Mapper      = coreService.Mapper;
 }
 public ModifyPortInputDeviceEventArgs(ICoreService eventCoreInstance, int portNumber, IPlatformInfo platformInfo, string previousPortInputDevice, string modifiedPortInputDevice)
     : base(eventCoreInstance)
 {
     this.portNumber = portNumber;
     this.Platform = platformInfo;
     this.PreviousPortInputDevice = previousPortInputDevice;
     this.ModifiedPortInputDevice = modifiedPortInputDevice;
 }
Esempio n. 39
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 public StudentMainWindow(ICoreService service)
     : base(service)
 {
     this.fileUploadObserver = new FileUploadObserver();
     this.sendTo = new StudentSendTo();
     this.StartPosition = FormStartPosition.CenterScreen;
     InitializeComponent();
 }
Esempio n. 40
0
        public DebugViewModel(ICoreService coreService, IRgbService rgbService, ISurfaceService surfaceService)
        {
            _coreService = coreService;
            _rgbService  = rgbService;

            surfaceService.SurfaceConfigurationUpdated       += (sender, args) => Execute.PostToUIThread(() => CurrentFrame = null);
            surfaceService.ActiveSurfaceConfigurationChanged += (sender, args) => Execute.PostToUIThread(() => CurrentFrame = null);
        }
 public ModifyPlatformPreferenceEventArgs(ICoreService eventCoreInstance, string previousPreference, string modifiedPreference, IPlatformInfo platform, PreferenceType preferenceType)
     : base(eventCoreInstance)
 {
     this.Platform = platform;
     this.PreferenceType = preferenceType;
     this.PreviousPreference = previousPreference;
     this.ModifiedPreference = modifiedPreference;
 }
        public async Task <bool> Initialize(ICoreService core)
        {
            provider = core;

            log = core.Logger;

            return(true);
        }
Esempio n. 43
0
        public ColorPickerService(IDialogService dialogService, ICoreService coreService, ISettingsService settingsService)
        {
            _dialogService = dialogService;
            _coreService   = coreService;

            PreviewSetting          = settingsService.GetSetting("UI.PreviewColorPickerOnDevices", false);
            PreviewSetting.AutoSave = true;
        }
Esempio n. 44
0
 protected BaseIdentifier(Assembly pluginAssembly, ICoreService coreInstance)
     : base(pluginAssembly, coreInstance)
 {
     if(this.PluginInfo.ContainsKey("identifier_valuetype")){
         this.IdentifiedValueType = this.PluginInfo["identifier_valuetype"];
     }else{
         this.IdentifiedValueType = IdentifiedValueTypes.Unknown;
     }
 }
Esempio n. 45
0
        public MefService2(IUnityContainer unityContainer,
            [Import("CoreService2")] ICoreService coreService)
        {
            m_UnityContainer = unityContainer;
            m_CoreService = coreService;

            Debug.Assert(m_UnityContainer != null);
            Console.WriteLine("MefService2.ctor()");
        }
 public JsonApiWebSocketServer(int port, ICoreService coreInstance)
 {
     this.coreInstance = coreInstance;
     this.server = new WebSocketServer($"ws://0.0.0.0:{port}");
     this.connections = new List<IWebSocketConnection>();
     this.SocketMessage += this.Process;
     this.SocketOpen += (s, e) => this.connections.Add(e.Connection);
     this.SocketClose += (s, e) => this.connections.Remove(e.Connection);
 }
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 public StudentLoginWindow(ICoreService service)
     : base(service)
 {
     this.hostIP = IPAddress.Parse(string.Format("{0}", service["host_ip"]));
     this.prots = service["portsettings"] as PortSettings;
     this.socket = new UDPSocket(this.prots.HostOrder);
     this.socket.DataArrival += this.receiveHostData;
     this.socket.Changed += this.showMessage;
     InitializeComponent();
 }
Esempio n. 48
0
        /// <summary>
        /// 构造函数。
        /// </summary>
        /// <param name="service"></param>
        /// <param name="classID"></param>
        /// <param name="catalogID"></param>
        public ModifyWorkWindow(ICoreService service, string classID, string catalogID)
            : base(service)
        {
            this.classID = classID;
            this.catalogID = catalogID;
            this.userInfo = this.CoreService["userinfo"] as UserInfo;

            this.pluginService = new LoadingPluginService(service, this);
            this.InitializeComponent();
        }
        /// <summary>
        /// 构造函数。
        /// </summary>
        /// <param name="service"></param>
        /// <param name="classID"></param>
        /// <param name="catalogID"></param>
        /// <param name="title"></param>
        public WorkThumbnailsWindow(ICoreService service, string title, string classID, string catalogID)
            : base(service)
        {
            this.strTitle = title;
            this.classID = classID;
            this.catalogID = catalogID;
            this.pluginService = new LoadingPluginService(this.CoreService, this);

            InitializeComponent();
        }
Esempio n. 50
0
 protected BaseScraper(Assembly pluginAssembly, ICoreService coreInstance)
     : base(pluginAssembly, coreInstance)
 {
     using (Stream stream = this.GetResource("scrapermap.json"))
     using (var reader = new StreamReader(stream))
     {
         string file = reader.ReadToEnd();
         var scraperMapValues = JsonConvert.DeserializeObject<BiDictionary<string, string>>(file);
         this.ScraperMap = scraperMapValues;
     }
 }
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 /// <param name="store"></param>
 /// <param name="students"></param>
 /// <param name="studentID"></param>
 public ModifyWorkDetailsWindow(ICoreService service, LocalStudentWorkStore store, string studentID)
     : base(service)
 {
     this.pluginService = new LoadingPluginService(service, this);
     //及时加载作业索引文件,同步修改信息。
     this.store = LocalStudentWorkStore.DeSerializer(store.FileSavePath());
     this.localStudentCollection = this.store.HasWorks();
     if (this.localStudentCollection != null && this.localStudentCollection.Count > 0 && !string.IsNullOrEmpty(studentID))
     {
         this.index = this.localStudentCollection.FindIndex(studentID);
     }
     this.InitializeComponent();
 }
Esempio n. 52
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 private HostNetService(ICoreService service, StartClassInfo sci)
 {
     this.info = service["userinfo"] as UserInfo;
     this.ports = service["portsettings"] as PortSettings;
     this.hostAddress = service["hostaddress"] as HostAddress;
     //主机广播。
     this.hostBroadcast = new HostBroadcastService(info);
     this.hostBroadcast.Changed += this.OnRaiseChanged;
     //主机侦听。
     this.hostListenService = new HostListenService(this.sci = sci, this.info, this.ports);
     this.hostListenService.Changed += this.OnRaiseChanged;
     this.hostListenService.UpdateControls += this.OnUpdateControls;
 }
Esempio n. 53
0
        protected BasePlugin(Assembly pluginAssembly, ICoreService coreInstance)
        {
            this.PluginAssembly = pluginAssembly;
            this.CoreInstance = coreInstance;
            string file = this.GetStringResource("plugin.json");
            var pluginInfo = JsonConvert.DeserializeObject<IDictionary<string, dynamic>>(file);
            this.PluginInfo = pluginInfo;

            this.PluginName = this.PluginInfo[PluginInfoFields.Name];
            this.Logger = LogManager.GetLogger(this.PluginName);
            this.SupportedPlatforms = this.PluginInfo[PluginInfoFields.SupportedPlatforms].ToObject<IList<string>>();
            this.PluginDataPath = Path.Combine(coreInstance.AppDataDirectory, "plugins", this.PluginName);
            if (!Directory.Exists(this.PluginDataPath)) Directory.CreateDirectory(this.PluginDataPath);
        }
Esempio n. 54
0
 public EmulatorBridge(Assembly pluginAssembly, ICoreService coreInstance)
     : base(pluginAssembly, coreInstance)
 {
     var flagsProtoTemplates = JsonConvert.DeserializeObject<IList<IDictionary<string, dynamic>>>(this.GetStringResource("flags.json"));
     this.ConfigurationFlags = flagsProtoTemplates.Select(protoTemplate => ConfigurationFlag.FromJsonProtoTemplate(protoTemplate)).ToDictionary(key => key.Key, key => key);
     var configurationProtoTemplates = JsonConvert.DeserializeObject<IList<IDictionary<string, dynamic>>>(this.GetStringResource("configurations.json"));
     this.ConfigurationTemplates = configurationProtoTemplates.Select(protoTemplate => ConfigurationTemplate.FromJsonProtoTemplate(protoTemplate, this)).ToDictionary(key => key.TemplateID, key => key);
     var inputProtoTemplates = JsonConvert.DeserializeObject<IList<IDictionary<string, dynamic>>>(this.GetStringResource("input.json"));
     this.InputTemplates = inputProtoTemplates.Select(protoTemplate => InputTemplate.FromJsonProtoTemplate(protoTemplate, this)).ToDictionary(key => key.Name, key => key);
     var controllerProtoTemplates = JsonConvert.DeserializeObject<IList<IDictionary<string, dynamic>>>(this.GetStringResource("controllers.json"));
     this.ControllerTemplates = controllerProtoTemplates.Select(protoTemplate => ControllerTemplate.FromJsonProtoTemplate(protoTemplate)).ToDictionary(key => key.ControllerID, key => key);
     this.EmulatorAssembly = coreInstance.Get<IEmulatorAssembliesManager>().EmulatorAssemblies[this.PluginInfo["emulator_assembly"]];
     this.ConfigurationFlagStore = new ConfigurationFlagStore(this);
 }
        public PaymentModule(ICoreService service)
            : base("/payment")
        {
            Get["/"] = _ =>
            {
                return View["Payments/TakePayment", new TransactionViewModel()
                {
                    ApiEnvironment = service.APIEnvironment,
                    RedirectUrl = ConfigurationManager.AppSettings["PublicWebUrl"] + "/payment/redirect-back",
                    Country = "GB" // Default it to help your customers, it's a long list!
                }];
            };

            Get["/redirect-back"] = _ =>
                {
                    // You can fetch the payment method before charging the card to say check the card type
                    var paymentMethod = service.GetPaymentMethod(Request.Query.token);

                    var transaction = service.ProcessPayment(new ProcessPaymentRequest
                    {
                        AmountInDecimal = 1.0m, // Same as saying Amount = 100
                        CurrencyCode = CurrencyCode.GBP,
                        PaymentMethodToken = Request.Query.token
                    });

                    if (transaction.Succeeded)
                    {
                        return View["Payments/Success"];
                    }

                    var viewModel = new TransactionViewModel();

                    viewModel.PopulateFromTransaction(transaction, ConfigurationManager.AppSettings["PublicWebUrl"] + "/payment/redirect-back", service.APIEnvironment);

                    return View["Payments/TakePayment", viewModel];
                };
        }
Esempio n. 56
0
        public void StartCore()
        {
            #if DEBUG
            this.loadedCore = new CoreService(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
            #else
            this.loadedCore = new CoreService(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Snowflake"));
            #endif
            this.loadedCore.Get<IEmulatorAssembliesManager>().LoadEmulatorAssemblies();
            this.loadedCore.Get<IPluginManager>().Initialize();
            this.loadedCore.Get<IAjaxManager>().Initialize(this.loadedCore.Get<IPluginManager>());
            foreach (IPlatformInfo platform in this.loadedCore.Platforms.Values)
            {
                this.loadedCore.Get<IControllerPortsDatabase>().AddPlatform(platform);
                this.loadedCore.Get <IPlatformPreferenceDatabase>().AddPlatform(platform);
            }
            this.loadedCore.Get<IServerManager>().RegisterServer("ThemeServer", new ThemeServer(Path.Combine(this.loadedCore.AppDataDirectory, "theme")));
            foreach (string serverName in this.loadedCore.Get<IServerManager>().RegisteredServers)
            {
                this.loadedCore.Get<IServerManager>().StartServer(serverName);
                var serverStartEvent = new ServerStartEventArgs(this.loadedCore, serverName);
                SnowflakeEventManager.EventSource.RaiseEvent(serverStartEvent); //todo Move event registration to SnowflakeEVentManager

            }
        }
        public GatewaysModule(ICoreService service)
            : base("/gateways")
        {
            Get["/"] = _ =>
                {
                    var gateways = service.GetGateways();

                    return View["Gateways", gateways];
                };

            Get["/add-test-gateway"] = _ =>
                {
                    service.AddGateway(new AddTestGatewayRequest());

                    return new RedirectResponse("/gateways");
                };

            Get["/redact/{token}"] = parameters =>
                {
                    service.RedactGateway((string) parameters.token);

                    return new RedirectResponse("/gateways");
                };
        }
Esempio n. 58
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 /// <param name="inputFilePath"></param>
 public WorkImportWindow(ICoreService service, string inputFilePath)
     : base(service)
 {
     this.inputFilePath = inputFilePath;
     InitializeComponent();
 }
Esempio n. 59
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 public UCNetPluginSet(ICoreService service)
     : base(service)
 {
     InitializeComponent();
 }
Esempio n. 60
0
 public GameDeleteEventArgs(ICoreService eventCoreInstance, IGameInfo gameInfo, IGameDatabase gameDatabase)
     : base(eventCoreInstance, gameInfo)
 {
     this.GameDatabase = gameDatabase;
 }