public virtual void ActualizarDatos(VideoAnalistaViewModel videoAnalistaView)
        {
            var videoAnalista = DependencyFactory.Resolve <IVideoAnalistaDA>().GetById(videoAnalistaView.Id);

            videoAnalistaView.MapperClass(videoAnalista, TypeMapper.IgnoreCaseSensitive);
            DependencyFactory.Resolve <IVideoAnalistaDA>().Save(videoAnalista);
        }
Exemplo n.º 2
0
        public JsonResult UpdatePasswordRecoveryPost(RecuperarUsuarioViewModel recuperarUsuario)
        {
            var passwordRecovery = DependencyFactory.Resolve<IUsuarioBusiness>();

            try
            {

                if(recuperarUsuario.Password != recuperarUsuario.VerificacionPassword)
                {
                    Response.StatusCode = 422;
                    return new JsonResult { Data = "Las contraseñas no coinciden", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
                }

                var userView = passwordRecovery.RecuperarUsuario(recuperarUsuario);

                Response.StatusCode = 200;
                return new JsonResult { Data = userView, JsonRequestBehavior = JsonRequestBehavior.AllowGet };

            }
            catch (ExceptionBusiness ex)
            {
                Response.StatusCode = 422; //Unprocessable entity
                return new JsonResult { Data = ex.Message, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                return new JsonResult { Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }

        }
Exemplo n.º 3
0
        public ActionResult LoginPost(UsuarioViewModel loginModel)
        {
            ILoginBusiness login = DependencyFactory.Resolve<ILoginBusiness>();
            try
            {
                var user = login.LoginUser(loginModel.Mail, loginModel.Password);
                var keyToken = StringCompressor.CompressString(user.SerializarToJson());
                FormsAuthentication.SetAuthCookie(keyToken, true);
                Response.StatusCode = 200;
                return new JsonResult { Data = user, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }
            catch (ExceptionBusiness ex)
            {

                Response.StatusCode = 404;
                return new JsonResult { Data = ex.Message, JsonRequestBehavior = JsonRequestBehavior.AllowGet };

            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                return new JsonResult { Data = "Error del servidor", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }


        }
Exemplo n.º 4
0
 public FormUsuario(Usuario usuario)
 {
     this.dbService = DependencyFactory.Resolve <IProcedureService>();
     this.Init();
     this.user = usuario;
     this.MostraRegistro();
 }
Exemplo n.º 5
0
        /// <summary>
        /// CTOR
        /// </summary>
        public CPUCoreWorkloadsViewModel()
        {
            this.openHardwareManagementService = DependencyFactory.Resolve <IOpenHardwareMonitorManagementService>(ServiceNames.OpenHardwareMonitorManagementService);

            // Register for events
            DependencyFactory.Resolve <IEventAggregator>(GeneralConstants.EventAggregator).GetEvent <OpenHardwareMonitorManagementServiceTimerTickEvent>().Subscribe(this.OpenHardwareMonitorManagementServiceTimerTickEventHandler, ThreadOption.UIThread);
        }
Exemplo n.º 6
0
        public WabbitcodeDebugger(string outputFile)
        {
            _disposed = false;

            _debuggerService = DependencyFactory.Resolve <IDebuggerService>();
            _fileService     = DependencyFactory.Resolve <IFileService>();
            _symbolService   = DependencyFactory.Resolve <ISymbolService>();

            WabbitcodeBreakpointManager.OnBreakpointAdded   += WabbitcodeBreakpointManager_OnBreakpointAdded;
            WabbitcodeBreakpointManager.OnBreakpointRemoved += WabbitcodeBreakpointManager_OnBreakpointRemoved;

            Debug.WriteLine("Creating wabbitemu debugger");
            _debugger = new WabbitemuDebugger();
            Debug.WriteLine("Loading file " + outputFile);
            _debugger.LoadFile(outputFile);
            _debugger.Visible       = true;
            _debugger.OnBreakpoint += BreakpointHit;
            _debugger.OnClose      += DebuggerOnClose;

            CurrentDebuggingFile = outputFile;
            IsAnApp            = outputFile.EndsWith(".8xk");
            _memoryAllocations = new List <KeyValuePair <ushort, ushort> >();
            CallStack          = new Stack <CallStackEntry>();
            MachineStack       = new Stack <StackEntry>();
            _oldSp             = IsAnApp ? TopStackApp : (ushort)0xFFFF;
            SetupInternalBreakpoints();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Delete tile sensor
        /// </summary>
        /// <param name="sensorName">The sensor name</param>
        /// <param name="gridRow">The grid row</param>
        /// <param name="gridColumn">The grid column</param>
        public void DeleteSensorTile(string sensorName, int gridRow, int gridColumn)
        {
            try
            {
                XDocument xmlDoc = XDocument.Load(this.configFile);

                var tileConfig = xmlDoc.Element("SensorTiles").Elements().Where(tc => tc.Attribute("SensorName").Value.Equals(sensorName) &&
                                                                                tc.Attribute("GridRow").Value.Equals(XmlConvert.ToString(gridRow)) &&
                                                                                tc.Attribute("GridColumn").Value.Equals(XmlConvert.ToString(gridColumn))).FirstOrDefault();

                if (tileConfig != null)
                {
                    tileConfig.Remove();
                }

                xmlDoc.Save(this.configFile);
            }
            catch (Exception ex)
            {
                var msg = DependencyFactory.Resolve <ILocalizerService>(ServiceNames.LocalizerService).GetLocalizedString("MainboardFanControlErrorReadingFanControllerTemplates");
                // Log-Exception
                DependencyFactory.Resolve <ILoggingService>(ServiceNames.LoggingService).LogException(msg, ex);
                // Show exception
                DependencyFactory.Resolve <IExceptionReporterService>(ServiceNames.ExceptionReporterService).ReportException(ex);
            }
        }
Exemplo n.º 8
0
        public JsonResult SearchPostCount(string searchValues)
        {
            BuscarJugadorViewModel buscar = new BuscarJugadorViewModel {
                Nombre = searchValues
            };
            var busqueda = DependencyFactory.Resolve <IBusquedaBusiness>();

            try
            {
                var userView = busqueda.BuscarJugadorCount(buscar);

                Response.StatusCode = 200;
                return(new JsonResult {
                    Data = userView, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch (ExceptionBusiness ex)
            {
                Response.StatusCode = 422; //Unprocessable entity
                return(new JsonResult {
                    Data = ex.Message, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch
            {
                Response.StatusCode = 500;
                return(new JsonResult {
                    Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
Exemplo n.º 9
0
        public JsonResult TopJugador()
        {
            try
            {
                IBusquedaBusiness business = DependencyFactory.Resolve <IBusquedaBusiness>();
                var result = business.TopJugador();
                result.ForEach(o => o.Link =
#if DEBUG
                                   "http://localhost:52771/#!/ProfilePublic/JugadorPublic/" + o.Id.ToString()
#else
                                   "http://allwiners.com/#!/ProfilePublic/JugadorPublic/" + o.Id.ToString()
#endif
                               );

                Response.StatusCode = 200;
                return(new JsonResult {
                    Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                return(new JsonResult {
                    Data = "Error de servidor", JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
Exemplo n.º 10
0
        public IList <DadosUsuarioDTO> BuscarLista()
        {
            var repositorio = DependencyFactory.Resolve <IDadosUsuarioRepositorio>();
            var requisicao  = repositorio.BuscarLista();

            return(Mapper.Map <IList <DadosUsuario>, IList <DadosUsuarioDTO> >(requisicao));
        }
Exemplo n.º 11
0
        public JsonResult SaveRecomendar(RecomendacionViewModel recomendacion)
        {
            var save = DependencyFactory.Resolve <IUsuarioJugadorBusiness>();

            try
            {
                // var userView = busqueda.BuscarJugadorCount(buscar);
                recomendacion.EmisorId = GetAuthData().Id;
                save.GuardarRecomendar(recomendacion);
                Response.StatusCode = 200;
                return(new JsonResult {
                    Data = "Ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch (ExceptionBusiness ex)
            {
                Response.StatusCode = 422; //Unprocessable entity
                return(new JsonResult {
                    Data = ex.Message, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch
            {
                Response.StatusCode = 500;
                return(new JsonResult {
                    Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
Exemplo n.º 12
0
        public void Cadastrar(DadosUsuarioDTO filtro)
        {
            var repositorio = DependencyFactory.Resolve <IDadosUsuarioRepositorio>();
            var dados       = Mapper.Map <DadosUsuarioDTO, DadosUsuario>(filtro);

            repositorio.Cadastrar(dados);
        }
Exemplo n.º 13
0
 public FindAllReferencesAction()
 {
     _dockingService   = DependencyFactory.Resolve <IDockingService>();
     _projectService   = DependencyFactory.Resolve <IProjectService>();
     _activeTextEditor = _dockingService.ActiveDocument as ITextEditor;
     _findResults      = _dockingService.GetDockingWindow <FindResultsWindow>();
 }
Exemplo n.º 14
0
        public dynamic GetPerfilShort()
        {
            var perfil = GetAuthData();

            try
            {
                if (perfil.JugadorId.HasValue)
                {
                    return(DependencyFactory.Resolve <IBusquedaBusiness>().GetPerfilJugadorShort(perfil));
                }
                else if (perfil.EntrenadorId.HasValue)
                {
                    return(DependencyFactory.Resolve <IBusquedaBusiness>().GetPerfilEntrenador(perfil));
                }
                else if (perfil.VideoAnalistaId.HasValue)
                {
                    return(DependencyFactory.Resolve <IBusquedaBusiness>().GetPerfilVideoAnalista(perfil));
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                throw new Exception("Error de servidor");
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Write Fan-Controller-Settings
        /// </summary>
        private void WriteFanControllerSettings(string settingName, object value)
        {
            try
            {
                // Read XML-File
                XDocument xdoc = XDocument.Load(DirectoryConstants.FanControllerSettingsConfig);

                // Check if elements exists
                if (xdoc.Descendants("FanControllerSettings").FirstOrDefault().HasElements)
                {
                    XElement settings = (from xml in xdoc.Descendants("MainboardFanController")
                                         where xml.Attribute("Name").Value == this.FanSensorName
                                         select xml).FirstOrDefault();

                    if (settings != null)
                    {
                        settings.SetElementValue(settingName, value);

                        xdoc.Save(DirectoryConstants.FanControllerSettingsConfig);
                    }
                }
            }
            catch (Exception ex)
            {
                var msg = DependencyFactory.Resolve <ILocalizerService>(ServiceNames.LocalizerService).GetLocalizedString("MainboardFanControlErrorWritingConfigFile");
                // Log-Exception
                DependencyFactory.Resolve <ILoggingService>(ServiceNames.LoggingService).LogException(msg, ex);
                // Show exception
                DependencyFactory.Resolve <IExceptionReporterService>(ServiceNames.ExceptionReporterService).ReportException(ex);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// CTOR
        /// </summary>
        public MainboardInformationViewModel()
        {
            this.MainboardInformation = DependencyFactory.Resolve <IHardwareInformationService>(ServiceNames.WmiHardwareInformationService).GetMainboardInformation();

            this.openHardwareMonitorManagementService = DependencyFactory.Resolve <IOpenHardwareMonitorManagementService>(ServiceNames.OpenHardwareMonitorManagementService);

            if (this.openHardwareMonitorManagementService != null)
            {
                if (this.openHardwareMonitorManagementService.MainboardVoltageSensorsWithName != null)
                {
                    foreach (var vs in this.openHardwareMonitorManagementService.MainboardVoltageSensorsWithName)
                    {
                        SensorTile st = new SensorTile();
                        st.HardwareSensor = vs;
                        this.MainboardVoltageSensors.Add(st);
                    }
                }

                if (this.openHardwareMonitorManagementService.MainboardTemperatureSensors != null)
                {
                    foreach (var ts in this.openHardwareMonitorManagementService.MainboardTemperatureSensors)
                    {
                        SensorTile st = new SensorTile();
                        st.HardwareSensor = ts;
                        this.MainboardTemperatureSensors.Add(st);
                    }
                }
            }

            // Register for events
            DependencyFactory.Resolve <IEventAggregator>(GeneralConstants.EventAggregator).GetEvent <OpenHardwareMonitorManagementServiceTimerTickEvent>().Subscribe(this.OpenHardwareMonitorManagementServiceTimerTickEventHandler, ThreadOption.UIThread);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Set Fan-Speed with a fixed value
        /// </summary>
        /// <param name="newValue">The new value</param>
        private void SetFanSpeed(float newValue)
        {
            if (!String.IsNullOrEmpty(this.FanSensorName) && this.SelectedTemperatureSensor != null)
            {
                try
                {
                    // Set new value
                    this.SetFanSensorValue(newValue);

                    OnPropertyChanged(() => this.CurrentFanSpeedValue);
                    OnPropertyChanged(() => this.MinFanSpeedValue);
                    OnPropertyChanged(() => this.MaxFanSpeedValue);
                }
                catch (Exception ex)
                {
                    // Set default mode!
                    this.IsDefaultModeEnabled = true;

                    var msg = DependencyFactory.Resolve <ILocalizerService>(ServiceNames.LocalizerService).GetLocalizedString("MainboardFanControlErrorSettingFanSpeed");
                    // Log-Exception
                    DependencyFactory.Resolve <ILoggingService>(ServiceNames.LoggingService).LogException(msg, ex);
                    // Show exception
                    DependencyFactory.Resolve <IExceptionReporterService>(ServiceNames.ExceptionReporterService).ReportException(ex);
                }
            }
        }
Exemplo n.º 18
0
        public ModerationTool()
        {
            ClientManager  = DependencyFactory.Resolve <ClientManager>();
            UserRepository = DependencyFactory.Resolve <IRepository <UserInfo> >();

            // TODO Load
        }
Exemplo n.º 19
0
        /// <summary>
        /// Read the settings file
        /// </summary>
        private void ReadSettingsFile()
        {
            try
            {
                XElement xmlDoc = XElement.Load(this.configFile);

                foreach (var t in xmlDoc.Descendants("SensorTile"))
                {
                    SensorTileConfigurationEntry configEntry = new SensorTileConfigurationEntry();

                    configEntry.SensorName = t.Attribute("SensorName").Value != null?t.Attribute("SensorName").Value : string.Empty;

                    configEntry.SensorCategory = t.Attribute("SensorCategory").Value != null?t.Attribute("SensorCategory").Value : string.Empty;

                    configEntry.SensorType = t.Attribute("SensorType").Value != null?t.Attribute("SensorType").Value : string.Empty;

                    configEntry.GridColumn = t.Attribute("GridColumn").Value != null?XmlConvert.ToInt32(t.Attribute("GridColumn").Value) : default(int);

                    configEntry.GridRow = t.Attribute("GridRow").Value != null?XmlConvert.ToInt32(t.Attribute("GridRow").Value) : default(int);

                    this.Tiles.Add(configEntry);
                }
            }
            catch (Exception ex)
            {
                var msg = DependencyFactory.Resolve <ILocalizerService>(ServiceNames.LocalizerService).GetLocalizedString("MainboardFanControlErrorReadingFanControllerTemplates");
                // Log-Exception
                DependencyFactory.Resolve <ILoggingService>(ServiceNames.LoggingService).LogException(msg, ex);
                // Show exception
                DependencyFactory.Resolve <IExceptionReporterService>(ServiceNames.ExceptionReporterService).ReportException(ex);
            }
        }
Exemplo n.º 20
0
        public DebugToolBar()
        {
            AllowItemReorder = true;
            GripStyle        = ToolStripGripStyle.Hidden;
            Items.AddRange(new ToolStripItem[]
            {
                _runDebuggerToolButton,
                _pauseToolButton,
                _stopDebugToolButton,
                _restartToolStripButton,
                _toolStripSeparator1,
                _gotoCurrentToolButton,
                _stepToolButton,
                _stepOverToolButton,
                _stepOutToolButton
            });
            RenderMode = ToolStripRenderMode.System;
            GripStyle  = ToolStripGripStyle.Visible;

            _runDebuggerToolButton.Click  += runDebuggerToolButton_Click;
            _pauseToolButton.Click        += pauseToolButton_Click;
            _stopDebugToolButton.Click    += stopDebugToolButton_Click;
            _restartToolStripButton.Click += restartToolStripButton_Click;
            _gotoCurrentToolButton.Click  += gotoCurrentToolButton_Click;
            _stepToolButton.Click         += stepToolButton_Click;
            _stepOverToolButton.Click     += stepOverToolButton_Click;
            _stepOutToolButton.Click      += stepOutToolButton_Click;

            _debuggerService = DependencyFactory.Resolve <IDebuggerService>();
            _debuggerService.OnDebuggingStarted += DebuggerService_OnDebuggingStarted;
            _debuggerService.OnDebuggingEnded   += DebuggerService_OnDebuggingEnded;
        }
Exemplo n.º 21
0
 public BuildAction()
 {
     _assemblerService = DependencyFactory.Resolve <IAssemblerService>();
     _debuggerService  = DependencyFactory.Resolve <IDebuggerService>();
     _projectService   = DependencyFactory.Resolve <IProjectService>();
     _statusBarService = DependencyFactory.Resolve <IStatusBarService>();
 }
Exemplo n.º 22
0
        public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request,
                                           Yupi.Protocol.IRouter router)
        {
            string friendName = request.GetString();

            UserInfo friend = UserRepository.Find(x => x.Name == friendName);

            if (friend != null)
            {
                if (friend.HasFriendRequestsDisabled)
                {
                    router.GetComposer <NotAcceptingRequestsMessageComposer>().Compose(session);
                }
                else
                {
                    IRepository <FriendRequest> requests = DependencyFactory.Resolve <IRepository <FriendRequest> > ();

                    if (!requests.Exists(x => x.To == friend && x.From == session.Info))
                    {
                        var friendRequest = new FriendRequest(session.Info, friend);

                        requests.Save(friendRequest);

                        var friendSession = ClientManager.GetByInfo(friend);

                        if (friendSession != null)
                        {
                            friendSession.Router.GetComposer <ConsoleSendFriendRequestMessageComposer>()
                            .Compose(friendSession, friendRequest);
                        }
                    }
                }
            }
        }
Exemplo n.º 23
0
        public static bool OpenDocument(FilePath filename)
        {
            var dockingService = DependencyFactory.Resolve <IDockingService>();
            var child          = dockingService.Documents.OfType <MapFileEditor>().SingleOrDefault(e => e.FileName == filename);

            if (child != null)
            {
                child.Show();
                return(true);
            }

            var name = Path.GetFileName(filename);
            var doc  = new MapFileEditor()
            {
                Text        = name,
                TabText     = name,
                ToolTipText = filename
            };

            doc.OpenFile(filename);


            dockingService.ShowDockPanel(doc);
            return(true);
        }
Exemplo n.º 24
0
 public CatalogController()
 {
     UserRepository     = DependencyFactory.Resolve <IRepository <UserInfo> >();
     CatalogRepository  = DependencyFactory.Resolve <IRepository <CatalogPage> >();
     AchievementManager = DependencyFactory.Resolve <AchievementManager>();
     OfferRepository    = DependencyFactory.Resolve <IRepository <CatalogOffer> >();
 }
Exemplo n.º 25
0
        public JsonResult PasswordRecoveryPost(SolicitudRecuperoUsuarioViewModel recuperarUsuario)
        {
            var passwordRecovery = DependencyFactory.Resolve<IUsuarioBusiness>();

            try
            {

                var userView = passwordRecovery.SolicitudRecuperoUsuario(recuperarUsuario);

                MailHelper.RecuperarUsuarioEmail(userView);

                Response.StatusCode = 200;
                return new JsonResult { Data = userView, JsonRequestBehavior = JsonRequestBehavior.AllowGet };

            }
            catch (ExceptionBusiness ex)
            {
                Response.StatusCode = 422; //Unprocessable entity
                return new JsonResult { Data = ex.Message, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                return new JsonResult { Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }

        }
Exemplo n.º 26
0
        internal static ImageViewer OpenImage(FilePath fileName)
        {
            IDockingService dockingService = DependencyFactory.Resolve <IDockingService>();
            var             child          = dockingService.Documents.OfType <ImageViewer>()
                                             .SingleOrDefault(e => e.FileName == fileName);

            if (child != null)
            {
                child.Show();
                return(child);
            }

            ImageViewer doc = new ImageViewer
            {
                Text        = Path.GetFileName(fileName),
                TabText     = Path.GetFileName(fileName),
                ToolTipText = fileName
            };

            doc.OpenFile(fileName);

            if (!Settings.Default.RecentFiles.Contains(fileName))
            {
                Settings.Default.RecentFiles.Add(fileName);
            }

            dockingService.ShowDockPanel(doc);
            return(doc);
        }
Exemplo n.º 27
0
        public JsonResult PasswordSave(UsuarioCambioPasswordViewModel password)
        {

            ILoginBusiness changePassword = DependencyFactory.Resolve<ILoginBusiness>();

            try
            {

                var authInfo = GetAuthData();

                password.Id = authInfo.Id;

                password.Mail = authInfo.Mail;

                var result = changePassword.ActualizarPassword(password);

                Response.StatusCode = 200;

                return new JsonResult { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet };

            }
            catch (ExceptionBusiness ex)
            {
                Response.StatusCode = 404;
                return new JsonResult { Data = ex.Message, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                return new JsonResult { Data = "Error de servidor", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }


        }
Exemplo n.º 28
0
        public PerfilJugadorShortViewModel GetPerfilJugadorShort()
        {
            var perfil = GetAuthData();

            try
            {
                if (perfil.JugadorId.HasValue)
                {
                    IBusquedaBusiness business = DependencyFactory.Resolve <IBusquedaBusiness>();
                    return(business.GetPerfilJugadorShort(perfil));
                }
                else if (perfil.EntrenadorId.HasValue)
                {
                    //TODO
                    return(null);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                throw new Exception("Error de servidor");
            }
        }
Exemplo n.º 29
0
        public JsonResult RegisterPost(UsuarioViewModel userModel)
        {
            var registracion = DependencyFactory.Resolve<IUsuarioBusiness>();

            try
            {

                var userView = registracion.Registracion(userModel);

                Response.StatusCode = 200;
                return new JsonResult { Data = userView, JsonRequestBehavior = JsonRequestBehavior.AllowGet };

            }
            catch (ExceptionBusiness ex)
            {
                Response.StatusCode = 422; //Unprocessable entity
                return new JsonResult { Data = ex.Message, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                return new JsonResult { Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }

        }
Exemplo n.º 30
0
        /// <summary>
        /// Get state of the service
        /// </summary>
        /// <param name="serviceName"></param>
        /// <returns></returns>
        public ServiceControllerStatus GetServiceState(string serviceName)
        {
            try
            {
                var serviceController = ServiceController.GetServices().Where(s => s.ServiceName.Equals(serviceName)).FirstOrDefault();

                if (serviceController != null)
                {
                    return(serviceController.Status);
                }
            }
            catch (Win32Exception ex1)
            {
                // Log-Exception
                DependencyFactory.Resolve <ILoggingService>(ServiceNames.LoggingService).LogException("ServiceManager: Fehler beim Zugriff auf eine System-API", ex1);
                // Show exception
                DependencyFactory.Resolve <IExceptionReporterService>(ServiceNames.ExceptionReporterService).ReportException(ex1);
            }
            catch (InvalidOperationException ex2)
            {
                // Log-Exception
                DependencyFactory.Resolve <ILoggingService>(ServiceNames.LoggingService).LogException("ServiceManager: Der Dienst wurde nicht gefunden", ex2);
                // Show exception
                DependencyFactory.Resolve <IExceptionReporterService>(ServiceNames.ExceptionReporterService).ReportException(ex2);
            }

            return(ServiceControllerStatus.Stopped);
        }