public void InitNetworkManager()
 {
     if(!MainClass.boRoot)
     {
         BTN_Network.Visible=false;
         LIB_Root.Visible=true;
     }
     else
     {
         LIB_Root.Visible=false;
     }
     //network init
     EnableDisable(INT_WICD,"wicd",LIB_WICDNotInstalled);
     EnableDisable(INT_NM,"networkmanager",LIB_NMNotInstalled);
     Service nm = new Service("NetworkManager");
     INT_NM.Active=nm.IsStartedOnBoot();
     Service wicd = new Service("wicd");
     INT_WICD.Active=wicd.IsStartedOnBoot();
     if(!INT_WICD.Active && !INT_NM.Active)
         INT_FW.Active=true;
 }
        protected void OnSelectionEntryService(object o, EventArgs args)
        {
            try
            {

             	TreeModel model;
                 if (((TreeSelection)o).GetSelected(out model, out iter))
                {
                    string T =(string)model.GetValue (iter, 0);
                    ServiceSelected=T;

                    BTN_ServiceStop.Visible=false;
                    BTN_ServiceStart.Visible=false;
                    BTN_ServiceDelBoot.Visible=false;
                    BTN_ServiceAddBoot.Visible=false;
                    Service service = new Service(T);
                    if (service.IsStarted())
                        BTN_ServiceStop.Visible=true;
                    else
                        BTN_ServiceStart.Visible=true;
                    if(service.IsStartedOnBoot())
                        BTN_ServiceDelBoot.Visible=true;
                    else
                        BTN_ServiceAddBoot.Visible=true;

                }
            }
            catch{}
        }
 protected virtual void OnBTNServiceStopClicked(object sender, System.EventArgs e)
 {
     if(ServiceSelected!="")
     {
     Service service = new Service(ServiceSelected);
     service.Stop();
     _serviceRefresh();
     }
 }
 protected virtual void OnBTNServiceDelBootClicked(object sender, System.EventArgs e)
 {
     if(ServiceSelected!="")
     {
     Service service = new Service(ServiceSelected);
     service.EnableDisableOnBoot(false);
     _serviceRefresh();
     }
 }
Exemple #5
0
        public static void CheckList()
        {
            if (_started) return;
            _started=false;
            Services.Clear();
            string rcFile="/etc/rc.d/";
            string[] files= Directory.GetFiles(rcFile,"rc.*",SearchOption.TopDirectoryOnly);

            foreach(string file in files)
            {
                string rcName=file.Replace(rcFile+"rc.","");
                if ((rcName!="halt") &&
                    (rcName!="0")&&
                    (rcName!="1")&&
                    (rcName!="2")&&
                    (rcName!="3")&&
                    (rcName!="4")&&
                    (rcName!="5")&&
                    (rcName!="6")&&
                    (rcName!="K")&&
                    (rcName!="M")&&
                    (rcName!="S")&&
                    (rcName!="zz-splash")&&
                    (rcName!="rmount")&&
                    (rcName!="fsck")&&
                    (rcName!="splash")&&
                    (rcName!="swap")&&
                    (rcName!="sysctl")&&
                    (rcName!="sysvinit")&&
                    (rcName!="time")&&
                    (rcName!="udev")&&
                    (rcName!="functions")&&
                    (rcName!="bootclean")&&
                    (rcName!="console")&&
                    (rcName!="font")&&
                    (rcName!="frugalware")&&
                    (rcName!="hostname")&&
                    (rcName!="local")&&
                    (rcName!="modules")&&
                    (rcName!="mount")&&
                    (rcName!="random")&&
                    (rcName!="serial")&&
                    (rcName!="single")&&
                    (rcName.IndexOf('~')<0)&&
                    (rcName!="reboot"))
                {
                    try{
                        if(Debug.ModeDebug)
                            Console.WriteLine(rcName);
                        Service service = new Service(rcName);
                      	Services.Add(service);
                    }
                    catch(Exception exe)
                    {
                        Console.WriteLine(rcName+" is ignored");
                        Console.WriteLine(exe.Message);
                    }
                }

            }
            Console.WriteLine("Service initialisation finish");
            _started=false;
        }