Ejemplo n.º 1
0
 /// <summary>
 /// A configuration has been deleted from the list of configurations tableview
 /// </summary>
 /// <param name="name">the configuration name</param>
 async void OnConfigurationDeleted(string name)
 {
     FPLog.Instance.WriteLine("Configuration Deleted: {0}", FPLog.LoggerLevel.LOG_INFORMATION, name);
     if (_loadedConfiguration.Name == name)
     {
         new UIAlertView("Error".Localize(), "Configuration In Use".Localize(), null, "Ok".Localize()).Show();
     }
     else
     {
         ConfigsEngine.DeleteConfiguration(name);
         _configsSource.UpdateData(await ConfigsEngine.GetListOfConfigurations());
         ConfigListTableView.ReloadData();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// load the list of configurations
        /// </summary>
        /// <param name="sender">Sender.</param>

        /*async partial void SelectConfiguration (NSObject sender)
         * {
         *
         * }*/

        async partial void OnSelectConfigurationBtnTouchUpInside(NSObject sender)
        {
            if (_configListPopOver.PopoverVisible)
            {
                return;
            }

            _configListPopOver.PresentFromRect(SelectConfigBtn.Frame, View, UIPopoverArrowDirection.Up, true);
            ConfigListTableView.Hidden = true;
            UIActivityIndicatorView activityIndicator = new UIActivityIndicatorView(new CoreGraphics.CGRect(ConfigListTableView.Frame.Width / 2 - 25, ConfigListTableView.Frame.Height / 2 - 25, 50, 50));

            activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;
            activityIndicator.StartAnimating();
            ConfigListTableView.AddSubview(activityIndicator);

            var confs = await ConfigsEngine.GetListOfConfigurations();

            _configsSource.UpdateData(confs);
            ConfigListTableView.ReloadData();
            ConfigListTableView.Hidden = false;
            activityIndicator.RemoveFromSuperview();
        }
Ejemplo n.º 3
0
        void ReleaseDesignerOutlets()
        {
            if (bannerView != null)
            {
                bannerView.Dispose();
                bannerView = null;
            }

            if (ConfigListTableView != null)
            {
                ConfigListTableView.Dispose();
                ConfigListTableView = null;
            }

            if (ConfigNameLbl != null)
            {
                ConfigNameLbl.Dispose();
                ConfigNameLbl = null;
            }

            if (EditBtn != null)
            {
                EditBtn.Dispose();
                EditBtn = null;
            }

            if (ExportConfigBtn != null)
            {
                ExportConfigBtn.Dispose();
                ExportConfigBtn = null;
            }

            if (ImportConfigBtn != null)
            {
                ImportConfigBtn.Dispose();
                ImportConfigBtn = null;
            }

            if (KeysCollectionView != null)
            {
                KeysCollectionView.Dispose();
                KeysCollectionView = null;
            }

            if (NewConfigBtn != null)
            {
                NewConfigBtn.Dispose();
                NewConfigBtn = null;
            }

            if (SearchConfigBtn != null)
            {
                SearchConfigBtn.Dispose();
                SearchConfigBtn = null;
            }

            if (SelectConfigBtn != null)
            {
                SelectConfigBtn.Dispose();
                SelectConfigBtn = null;
            }

            if (SettingsBtn != null)
            {
                SettingsBtn.Dispose();
                SettingsBtn = null;
            }
        }
Ejemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            bannerView.Hidden = true;

            UIApplication.SharedApplication.SetStatusBarHidden(true, false);
            Util.SetColorsOnStartup();
            this.KeysCollectionView.BackgroundColor = Util.BackgroundColor;

            ClearButton(ExportConfigBtn);
            ExportConfigBtn.SetImage(Images.ExportConfigImg, UIControlState.Normal);
            ClearButton(ImportConfigBtn);
            ImportConfigBtn.SetImage(Images.ImportConfigImg, UIControlState.Normal);
            ClearButton(NewConfigBtn);
            NewConfigBtn.SetImage(Images.NewConfigImg, UIControlState.Normal);
            ClearButton(SearchConfigBtn);
            SearchConfigBtn.SetImage(Images.SearchConfigImg, UIControlState.Normal);
            ClearButton(SelectConfigBtn);
            SelectConfigBtn.SetImage(Images.ListConfigsImg, UIControlState.Normal);
            ClearButton(SettingsBtn);
            SettingsBtn.SetImage(Images.SettingsImg, UIControlState.Normal);
            ClearButton(EditBtn);
            EditBtn.SetImage(Images.EditConfigImg, UIControlState.Normal);
            //EditBtn.SetImage(Images.EditConfigImgSelected,UIControlState.Selected);

            //load last used configuration or default
            if (Util.GetLastConfigurationUsed() == null)                //this is the first run ever
            {
                DBManager.Instance.CreateTables();
                _keySourceData = new KeySource(new List <FPKey> ());
            }
            else
            {
                _loadedConfiguration = ConfigsEngine.LoadConfiguration(Util.GetLastConfigurationUsed());
                _keySourceData       = new KeySource(_loadedConfiguration.Keys);
                ConfigNameLbl.Text   = _loadedConfiguration.Name.ToUpper();
            }

            //TODO add iphone
            KeysCollectionView.RegisterNibForCell(UINib.FromName("KeyCell_iPad", NSBundle.MainBundle), KeyCell.Key);

            _keySourceData.KeyPressed += HandleKeyPressed;
            _keySourceData.OnKeyMoved += HandleKeyMoved;
            KeysCollectionView.Source  = _keySourceData;
            KeysCollectionView.DelaysContentTouches = false;

            var longPressGesture = new UILongPressGestureRecognizer(HandleLongGesture);

            KeysCollectionView.AddGestureRecognizer(longPressGesture);

            #region Config popOver
            UIViewController configListViewController = new UIViewController();
            configListViewController.View = ConfigListTableView;
            configListViewController.View.BackgroundColor = UIColor.White;
            _configListPopOver = new UIPopoverController(configListViewController);
            _configListPopOver.BackgroundColor = UIColor.White;

            _configsSource = new ConfigurationsListSource();
            _configsSource.OnConfigurationSelected += OnConfigurationSelected;
            _configsSource.OnConfigurationDeleted  += OnConfigurationDeleted;

            ConfigListTableView.Source = _configsSource;
            ConfigListTableView.ReloadData();
            ConfigListTableView.TableFooterView = new UIView();
            #endregion

            Util.OnEnableNightMode += OnNightModeChanged;

#if !DISCONNECTED
            CommsEngine.Instance.OnServerDisconnected += HandleOnServerDisconnected;
            if (Util.GetServerIP() == null)                //first Time
            {
                PresentServerSelection();
            }
            else
            {
                CommsEngine.Instance.OnClientConnected += HandleOnClientConnected;
                ConnectToLastKnownServer();
            }
#else
            if (Util.GetLastConfigurationUsed() == null)
            {
                LoadDefaultConfiguration();
            }
                        #endif
        }