Ejemplo n.º 1
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.º 2
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
        }