Exemple #1
0
        private Section CreateRectangularAnimation()
        {
            var animationOption = SwitchRow.Create(
                "Animation",
                () => SettingsManager.Instance.RectangularViewfinderAnimation != null,
                enabled =>
            {
                SettingsManager.Instance.RectangularViewfinderAnimation = enabled ?
                                                                          new RectangularViewfinderAnimation(looping: false) : null;
                this.DataSourceListener.OnDataChange();
            });

            var loopingOption = SwitchRow.Create(
                "Looping",
                () => SettingsManager.Instance.RectangularViewfinderAnimation?.Looping ?? false,
                enabled =>
            {
                SettingsManager.Instance.RectangularViewfinderAnimation =
                    new RectangularViewfinderAnimation(looping: enabled);
            });

            if (SettingsManager.Instance.RectangularViewfinderAnimation != null)
            {
                return(new Section(new[] { animationOption, loopingOption }));
            }

            return(new Section(new[] { animationOption }));
        }
 public FeedbackDataSource(IDataSourceListener dataSource)
 {
     this.DataSourceListener = DataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             SwitchRow.Create(
                 "Sound",
                 () => SettingsManager.Instance.Feedback.Sound != null,
                 value =>
             {
                 Sound sound  = value ? Sound.DefaultSound : null;
                 var feedback = new Feedback(SettingsManager.Instance.Feedback.Vibration, sound);
                 SettingsManager.Instance.Feedback = feedback;
             }
                 ),
             SwitchRow.Create(
                 "Vibration",
                 () => SettingsManager.Instance.Feedback.Vibration != null,
                 value =>
             {
                 Vibration vibration = value ? Vibration.DefaultVibration : null;
                 var feedback        = new Feedback(vibration, SettingsManager.Instance.Feedback.Sound);
                 SettingsManager.Instance.Feedback = feedback;
             }
                 )
         })
     };
 }
 public FeedbackDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new Row[]
         {
             SwitchRow.Create(
                 "Sound",
                 () => SettingsManager.Instance.Feedback.Sound != null,
                 value =>
             {
                 Sound sound  = value ? Sound.DefaultSound : null;
                 var feedback = new Feedback(SettingsManager.Instance.Feedback.Vibration, sound);
                 SettingsManager.Instance.Feedback = feedback;
             }
                 ),
             ChoiceRow <VibrationType> .Create(
                 "Vibration",
                 Enumeration.GetAll <VibrationType>().ToArray(),
                 () => VibrationType.Create(SettingsManager.Instance.Vibration),
                 type => {
                 SettingsManager.Instance.Vibration = type.Vibration;
                 var feedback = new Feedback(
                     SettingsManager.Instance.Vibration,
                     SettingsManager.Instance.Feedback.Sound);
                 SettingsManager.Instance.Feedback = feedback;
             },
                 this.DataSourceListener
                 )
         })
     };
 }
Exemple #4
0
    protected virtual void Start()
    {
        switch_           = gameObject.AddComponent <Switch> ();
        rotate            = gameObject.AddComponent <Rotate> ();
        switchRow         = gameObject.AddComponent <SwitchRow> ();
        finishedAnimation = true;

        if (SceneManager.GetActiveScene().buildIndex == Constants.GameScene)
        {
            spawner = (LevelSpawner)GameObject.Find("LevelSpawner").GetComponent <LevelSpawner> ();
        }
        else if (SceneManager.GetActiveScene().buildIndex == Constants.LevelEditorScene)
        {
            spawner = (LevelEditorSpawner)GameObject.Find("EditorSpawner").GetComponent <LevelEditorSpawner> ();
        }
        else if (SceneManager.GetActiveScene().buildIndex == Constants.TutorialScenes[0])
        {
            spawner = (Tutorial1Spawner)GameObject.Find("TutorialSpawner").GetComponent <Tutorial1Spawner>();
        }
        else if (SceneManager.GetActiveScene().buildIndex == Constants.TutorialScenes[1])
        {
            spawner = (Tutorial2Spawner)GameObject.Find("TutorialSpawner").GetComponent <Tutorial2Spawner>();
        }
        else if (SceneManager.GetActiveScene().buildIndex == Constants.TutorialScenes[2])
        {
            spawner = (Tutorial3Spawner)GameObject.Find("TutorialSpawner").GetComponent <Tutorial3Spawner>();
        }
        else if (SceneManager.GetActiveScene().buildIndex == Constants.TutorialScenes[3])
        {
            spawner = (Tutorial4Spawner)GameObject.Find("TutorialSpawner").GetComponent <Tutorial4Spawner>();
        }

        tutSpawner = GameObject.FindObjectOfType <BaseTutorialSpawner> ();
    }
Exemple #5
0
        public StatusAccountPage(ProfileDataResult profileData, ServiceNode serviceNode, long accountId, StatusAccountProfileType profileType, long transactionId) : base("StatusAccountPage")
        {
            Subscribe <SubscriptionEvent>(Subscription);
            Subscribe <ProfileDataResultEvent>(ProfileData);

            StackLayout.Suspended = true;

            _transactionId = transactionId;
            _profileType   = profileType;
            _serviceNode   = serviceNode;
            _status        = StatusApp.Current.GetStatus(serviceNode);
            _accountId     = accountId;
            _accountIndex  = Chain.Index.New().Add(_accountId).Build();

            _messagesDownload = new AccountIndexTransactionDownload(accountId, StatusServiceInfo.MessageIndex, serviceNode.GetTransactionDownloadManager(StatusServiceInfo.StatusDataChainIndex))
            {
                Count = 10
            };

            AddTitleRow("Title");

            if (profileType == StatusAccountProfileType.Small || transactionId > 0)
            {
                var row = new StatusProfileButtonRow(serviceNode, _accountId, profileData?.ProfileInfo, profileData, async(button) =>
                {
                    await Navigation.PushAsync(new StatusAccountPage(profileData, serviceNode, accountId, StatusAccountProfileType.Big, transactionId));
                }, false);

                AddRow(row);
            }

            if (profileType == StatusAccountProfileType.Big && transactionId <= 0)
            {
                if (_status != null)
                {
                    AddHeaderRow("Subscription");

                    _subscribe = AddSwitchRow("Subscribe");
                    _subscribe.Switch.IsToggled    = _status.IsSubscribed(_accountId);
                    _subscribe.Switch.ToggledAsync = Subscribe_Toggled;
                    _subscribe.SetDetailViewIcon(Icons.Check);

                    _notification = AddSwitchRow("Notification");
                    _notification.Switch.IsToggled    = UIApp.Current.IsPushChannelSubscribed(_accountIndex);
                    _notification.Switch.ToggledAsync = Notification_Toggled;
                    _notification.SetDetailViewIcon(Icons.Bell);

                    AddFooterRow();
                }

                if (profileData == null || profileType == StatusAccountProfileType.Big)
                {
                    UIApp.Run(() => ProfileManager.Current.GetProfileData(_accountId, ProfileDownloadType.ForceDownload, true));
                }
            }

            IsBusy = true;
        }
Exemple #6
0
        public ScanAreaDataSource(IDataSourceListener dataSourceListener)
        {
            this.DataSourceListener = dataSourceListener;

            this.Sections = new[]
            {
                new Section(new []
                {
                    FloatWithUnitRow.Create(
                        "Top",
                        () => SettingsManager.Instance.ScanAreaMargins.Top,
                        value =>
                    {
                        SettingsManager.Instance.ScanAreaMargins =
                            SettingsManager.Instance.ScanAreaMargins.NewWithTop(value);
                    },
                        this.DataSourceListener
                        ),
                    FloatWithUnitRow.Create(
                        "Right",
                        () => SettingsManager.Instance.ScanAreaMargins.Right,
                        value =>
                    {
                        SettingsManager.Instance.ScanAreaMargins = SettingsManager.Instance.ScanAreaMargins.NewWithRight(value);
                    },
                        this.DataSourceListener
                        ),
                    FloatWithUnitRow.Create(
                        "Bottom",
                        () => SettingsManager.Instance.ScanAreaMargins.Bottom,
                        value =>
                    {
                        SettingsManager.Instance.ScanAreaMargins = SettingsManager.Instance.ScanAreaMargins.NewWithBottom(value);
                    },
                        this.DataSourceListener
                        ),
                    FloatWithUnitRow.Create(
                        "Left",
                        () => SettingsManager.Instance.ScanAreaMargins.Left,
                        value =>
                    {
                        SettingsManager.Instance.ScanAreaMargins = SettingsManager.Instance.ScanAreaMargins.NewWithLeft(value);
                    },
                        this.DataSourceListener
                        )
                }, "Margins"),
                new Section(new Row[]
                {
                    SwitchRow.Create(
                        "Should Show Scan Area Guides",
                        () => SettingsManager.Instance.ShouldShowScanAreaGuides,
                        value => SettingsManager.Instance.ShouldShowScanAreaGuides = value
                        )
                })
            };
        }
 private Section CreateTorchSection()
 {
     return(new Section(new[]
     {
         SwitchRow.Create(
             "Desired Torch State",
             () => SettingsManager.Instance.TorchState == TorchState.On,
             value => SettingsManager.Instance.TorchState = value ? TorchState.On : TorchState.Off
             )
     }));
 }
Exemple #8
0
 public ResultDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             SwitchRow.Create(
                 "Continuous Scanning",
                 () => SettingsManager.Instance.ContinuousModeEnabled,
                 value => SettingsManager.Instance.ContinuousModeEnabled = value
                 )
         })
     };
 }
 public ControlsDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             SwitchRow.Create(
                 "Torch Button",
                 () => SettingsManager.Instance.TorchSwitchShown,
                 value => SettingsManager.Instance.TorchSwitchShown = value
                 )
         })
     };
 }
 public GesturesDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             SwitchRow.Create(
                 "Tap to Focus",
                 () => SettingsManager.Instance.TapToFocus != null,
                 enabled => SettingsManager.Instance.TapToFocus = enabled ? TapToFocus.Create() : null
                 ),
             SwitchRow.Create(
                 "Swipe to Zoom",
                 () => SettingsManager.Instance.SwipeToZoom != null,
                 enabled => SettingsManager.Instance.SwipeToZoom = enabled ? SwipeToZoom.Create(): null
                 )
         })
     };
 }
        private Section CreateGeneralSection()
        {
            var enabled = SwitchRow.Create(
                "Enabled",
                () => this.symbologySettings.Enabled,
                enabled => this.symbologySettings.Enabled = enabled
                );
            var rows = new List <Row>()
            {
                enabled
            };

            if (this.symbologyDescription.ColorInvertible)
            {
                rows.Add(SwitchRow.Create(
                             "Color Inverted",
                             () => this.symbologySettings.ColorInvertedEnabled,
                             enabled => this.symbologySettings.ColorInvertedEnabled = enabled
                             ));
            }

            return(new Section(rows.ToArray()));
        }
Exemple #12
0
        public ChainKeyPage(ChainPage chainPage, List <ChainKeyItem> chainKeys) : base("ChainKeyPage")
        {
            _chainPage = chainPage;

            AddTitleRow("Title");

            AddHeaderRow("Key");

            _name = AddEntryRow(null, "Name");
            _name.SetDetailViewIcon(Icons.Pencil);

            _key = AddEditorRow(null, "Key");
            _key.SetDetailViewIcon(Icons.Key);

            AddButtonRow("KeyButton", NewKey);

            _keyIndex = AddEntryRow(string.Empty, "KeyIndex");
            _keyIndex.SetDetailViewIcon(Icons.Highlighter);

            AddFooterRow();

            AddHeaderRow("KeyOptions");

            _admin       = AddSwitchRow("Admin");
            _serviceKey  = AddSwitchRow("ServiceKey");
            _serviceVote = AddSwitchRow("ServiceVote");
            _dataKey     = AddSwitchRow("DataKey");
            _dataVote    = AddSwitchRow("DataVote");
            _chainIndex  = AddEntryRow(string.Empty, "ChainIndex");

            _admin.Switch.Toggled = (swt) =>
            {
                if (swt.IsToggled)
                {
                    _serviceKey.Switch.IsToggled  = false;
                    _serviceVote.Switch.IsToggled = false;
                    _dataKey.Switch.IsToggled     = false;
                    _dataVote.Switch.IsToggled    = false;
                    _chainIndex.Edit.Text         = null;
                }
                Status.ReValidate();
            };

            _serviceKey.Switch.Toggled = (swt) =>
            {
                if (swt.IsToggled)
                {
                    _admin.Switch.IsToggled    = false;
                    _dataKey.Switch.IsToggled  = false;
                    _dataVote.Switch.IsToggled = false;
                    _chainIndex.Edit.Text      = null;
                }
                else
                {
                    _serviceVote.Switch.IsToggled = false;
                }
                Status.ReValidate();
            };

            _serviceVote.Switch.Toggled = (swt) =>
            {
                if (swt.IsToggled)
                {
                    _serviceKey.Switch.IsToggled = true;
                }
            };

            _dataKey.Switch.Toggled = (swt) =>
            {
                if (swt.IsToggled)
                {
                    _admin.Switch.IsToggled       = false;
                    _serviceKey.Switch.IsToggled  = false;
                    _serviceVote.Switch.IsToggled = false;
                }
                else
                {
                    _dataVote.Switch.IsToggled = false;
                }
                Status.ReValidate();
            };

            _dataVote.Switch.Toggled = (swt) =>
            {
                if (swt.IsToggled)
                {
                    _dataKey.Switch.IsToggled = true;
                }
            };

            AddFooterRow();

            AddHeaderRow("Password");

            _pw1 = AddEntryRow(string.Empty, "Password");
            _pw1.SetDetailViewIcon(Icons.Unlock);
            _pw2 = AddEntryRow(string.Empty, "Password2");
            _pw2.SetDetailViewIcon(Icons.Unlock);
            _pw1.Edit.IsPassword = _pw2.Edit.IsPassword = true;

            AddFooterRow();

            Status.Add(_key.Edit, T("KeyStatus"), (view, entry, newText, oldtext) =>
            {
                try
                {
                    var key = Key.Restore(entry.Text);
                    return(key.KeyType == Protocol.TransactionKeyType);
                }
                catch { }
                return(false);
            }).
            Add(_keyIndex.Edit, T("KeyIndexStatus", short.MinValue, short.MaxValue), (view, entry, newText, oldText) =>
            {
                if (short.TryParse(newText, out var idx))
                {
                    foreach (var key in chainKeys)
                    {
                        if (key.Item.KeyIndex == idx)
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                if (!newText.IsNullOrEmpty())
                {
                    entry.Text = oldText;
                }
                return(false);
            }).
            Add(_chainIndex.Edit, T("ChainIndexStatus"), (view, entry, newText, oldText) =>
            {
                if (_dataKey.Switch.IsToggled)
                {
                    return(StatusValidators.PositiveNumberValidatorWithZero(view, entry, newText, oldText));
                }

                if (!string.IsNullOrEmpty(newText))
                {
                    entry.Text = null;
                }

                return(true);
            }).
            Add(_name.Edit, T("NameStatus"), (view, entry, newText, oldtext) =>
            {
                return(!newText.IsNullOrWhiteSpace());
            }).
            Add(_pw1.Edit, T("PasswordStatus", WalletApp.MinPasswordLength), (view, entry, newText, oldtext) =>
            {
                var pw1 = _pw1.Edit.Text;
                var pw2 = _pw2.Edit.Text;

                return(WalletApp.IsValidPassword(pw1) && WalletApp.IsValidPassword(pw2) && pw1 == pw2);
            });

            _pw2.Edit.TextChanged += (sender, e) =>
            {
                Status.ReValidate();
            };

            AddSubmitRow("Submit", Submit);
        }