private void ResetWindow()
 {
     IsStopping = false;
     LoadAccountsBtn.Invoke(new Action(() => LoadAccountsBtn.IsEnabled = true));
     LoadProxyBtn.Invoke(new Action(() => LoadProxyBtn.IsEnabled       = true));
     StartBtn.Invoke(new Action(() => StartBtn.IsEnabled         = true));
     StopBtn.Invoke(new Action(() => StopBtn.IsEnabled           = false));
     SettingsBtn.Invoke(new Action(() => SettingsBtn.IsEnabled   = true));
     ProxyTypeBox.Invoke(new Action(() => ProxyTypeBox.IsEnabled = true));
 }
 void OnCloseBtn()
 {
     SettingsBtn.playSoundOnClosingSettingsPanel();
     close();
 }
        public PageViewerCommandBar()
        {
            this.InitializeComponent();

            _showSettings     = new Subject <Unit>();
            _scrollToTop      = new Subject <Unit>();
            _printPdf         = new Subject <Unit>();
            _edit             = new Subject <Unit>();
            _search           = new Subject <Unit>();
            _showHistory      = new Subject <Unit>();
            _toggleFullscreen = new Subject <Unit>();
            _import           = new Subject <Unit>();
            _export           = new Subject <Unit>();
            _navigateToPage   = new Subject <string>();

            this.WhenActivated(disposable =>
            {
                this.OneWayBind(ViewModel,
                                vm => vm.DevOptsEnabled,
                                view => view.DevOptBtn.Visibility)
                .DisposeWith(disposable);

                SettingsBtn.Events().Click
                .Select(x => Unit.Default)
                .Subscribe(x => { _showSettings.OnNext(x); }).DisposeWith(disposable);

                ToTopBtn.Events().Click
                .Select(x => Unit.Default)
                .Subscribe(x => { _scrollToTop.OnNext(x); }).DisposeWith(disposable);

                PdfBtn.Events().Click
                .Select(x => Unit.Default)
                .Subscribe(x => { _printPdf.OnNext(x); }).DisposeWith(disposable);

                SearchBtn.Events().Click
                .Select(x => Unit.Default)
                .Subscribe(x => { _search.OnNext(x); }).DisposeWith(disposable);

                HistoryBtn.Events().Click
                .Select(x => Unit.Default)
                .Subscribe(x => { _showHistory.OnNext(x); }).DisposeWith(disposable);

                FullscreenBtn.Events().Click
                .Select(x => Unit.Default)
                .Subscribe(x => { _toggleFullscreen.OnNext(x); }).DisposeWith(disposable);

                ImportBtn.Events().Click
                .Select(x => Unit.Default)
                .Subscribe(x => { _import.OnNext(x); }).DisposeWith(disposable);

                ExportBtn.Events().Click
                .Select(x => Unit.Default)
                .Subscribe(x => { _export.OnNext(x); }).DisposeWith(disposable);

                EditBtn.Events().Click
                .Select(_ => Unit.Default)
                .Subscribe(x => { _edit.OnNext(Unit.Default); }).DisposeWith(disposable);

                NewPageBtn.Events().Click
                .Select(_ => Unit.Default)
                .InvokeCommand(ViewModel.NewPageClick)
                .DisposeWith(disposable);

                DevOptBtn.Events().Click
                .Select(_ => Unit.Default)
                .InvokeCommand(ViewModel.DevOptionsClick)
                .DisposeWith(disposable);

                BindTextResources(disposable);

                ShowLastVisitedPages();
            });
        }
Exemple #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
        }