Example #1
0
 partial void Enabler(UISwitch sender)
 {
     if (sender.On)
     {
         NSUserDefaults.StandardUserDefaults.SetBool(true, "FTPServer");
         Manager.Singletone.RunFTPServer((exception) => {
             new Thread(() => {
                 Manager.Singletone.StopFTPServer();
                 Thread.Sleep(250);
                 InvokeOnMainThread(delegate {
                     FTPSwitcher.SetState(false, true);
                 });
                 Console.WriteLine("Fail");
                 Console.WriteLine(exception.Message);
             }).Start();
         }, delegate {
             InvokeOnMainThread(delegate {
                 TableView.ReloadData();
             });
             Console.WriteLine("Success");
         });
     }
     else
     {
         NSUserDefaults.StandardUserDefaults.SetBool(false, "FTPServer");
         Manager.Singletone.StopFTPServer();
     }
     TableView.ReloadData();
 }
Example #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            bool state = (Manager.Singletone.ftpThread != null && Manager.Singletone.ftpThread.IsAlive);            //NSUserDefaults.StandardUserDefaults.BoolForKey("FTPServer");

            FTPSwitcher.SetState(state, false);
            FTPBackgroundSwitcher.SetState(NSUserDefaults.StandardUserDefaults.BoolForKey("FTPServerBackground"), false);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            bool state = (Manager.Singletone.ftpThread != null && Manager.Singletone.ftpThread.IsAlive);            //NSUserDefaults.StandardUserDefaults.BoolForKey("FTPServer");

            FTPSwitcher.SetState(state, false);
            FTPBackgroundSwitcher.SetState(NSUserDefaults.StandardUserDefaults.BoolForKey(UserDefaultsKeys.FTPServerBackground), false);
            BackgroundEnabler.SetState(NSUserDefaults.StandardUserDefaults.BoolForKey(UserDefaultsKeys.BackgroundModeEnabled), false);
            DHTSwitcher.SetState(NSUserDefaults.StandardUserDefaults.BoolForKey(UserDefaultsKeys.DHTEnabled), false);
            BackgroundTypeButton.SetTitle(((BackgroundTypes)(int)NSUserDefaults.StandardUserDefaults.IntForKey(UserDefaultsKeys.BackgroundModeType)).ToString(), UIControlState.Normal);

            CheckUpdate();
        }