Ejemplo n.º 1
0
 public void InitInfos()
 {
     string fname = Utility.GetInfoFile();
     if (File.Exists(fname))
     {
         _infos = ServiceInstaller.DeSerializeObject<ServiceInfos>(fname);
     }
     else
     {
         _infos = new ServiceInfos();
         _infos.ServiceType = ServiceInstaller.ServiceBootFlag.AutoStart;
         _infos.ServiceName = Utility.GetServiceName();
     }
 }
Ejemplo n.º 2
0
        public ServiceInfos GetInfos()
        {
            ServiceInfos info = new ServiceInfos();
            info.ServiceName = tbServiceName.Text;
            info.DisplayName = tbDisplayName.Text;
            info.ServiceDescription = tbServiceDescription.Text;
            info.ServiceType = IndexToType(dlStartType.SelectedIndex);
            if (cbLocalSystem.Checked)
            {
                info.ServiceAccount = null;
                info.ServicePassword = null;
            }
            else
            {
                info.ServiceAccount = tbServiceAccount.Text;
                info.ServicePassword = tbServicePassword.Text;
            }

            return info;
        }
Ejemplo n.º 3
0
        private void OnInit(object sender, EventArgs e)
        {
            _infoFile = Utility.GetInfoFile();
            if (File.Exists(_infoFile))
            {
                _infos = ServiceInstaller.DeSerializeObject <ServiceInfos>(_infoFile);
            }
            else
            {
                _infos             = new ServiceInfos();
                _infos.ServiceType = ServiceInstaller.ServiceBootFlag.AutoStart;
                _infos.ServiceName = Utility.GetServiceName();
            }

            tbServiceName.Text = _infos.ServiceName;

            bool   isInstalled = ServiceInstaller.ServiceIsInstalled(tbServiceName.Text);
            bool   isAdmin     = Utility.IsAdministrator();
            string message;

            if (isInstalled)
            {
                if (isAdmin)
                {
                    message = "Service installed ....";
                    btnUninstall.Enabled = true;
                }
                else
                {
                    message = "Service installed, but application not started as Administrator...";
                    btnUninstall.Enabled = false;
                }
            }
            else
            {
                message = "Service not installed ....";
                btnUninstall.Enabled = false;
            }

            lbMessage.Text = message;
        }
Ejemplo n.º 4
0
 public void SetServiceInfos(ServiceInfos info)
 {
     _infos = info;
     DisplayInfos();
 }