Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ScannerCode.Log("OnCreate...");
            ScannerCode.ScanCount = 0;
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);



            selectScanner               = FindViewById <Spinner>(Resource.Id.openReaderSpinner);
            openScanner                 = FindViewById <Android.Widget.Switch>(Resource.Id.openScannerSwitch);
            scanData                    = FindViewById <TextView>(Resource.Id.scanDataView);
            scanButton                  = FindViewById <Button>(Resource.Id.scanButton);
            symConfig                   = FindViewById <Button>(Resource.Id.config_symbologies);
            symConfig.Click            += SymConfig_Click;
            scanButton.Click           += ScanButton_Click;
            selectScanner.ItemSelected += SelectScanner_ItemSelected;
            openScanner.CheckedChange  += OpenScanner_CheckedChange;
            //pass the context of this activity to the ScannCode class
            ScannerCode.AppContext = this.context;

            // Register ScanCode events from static instance
            ScannerCode.Log("Attach Scan_Result_Event...");


            getReaderList();
        }
Exemplo n.º 2
0
    protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
    {
        var cell = base.GetCellCore(item, convertView, parent, context);

        // cell.SetBackgroundColor(new Android.Graphics.Color(0, 0, 0));
        //var f = ((LinearLayout)(((LinearLayout)cell).GetChildAt(1))).GetChildAt(2);
        // print("FFFFFFFFFF:" + f.ToString());
        cell.SetBackgroundColor(new Android.Graphics.Color(20, 20, 20));
        //  print("-->>>" + cell);
        // var child1 = ((LinearLayout)cell).GetChildAt(1);
        try {
            Android.Widget.Switch child0 = (Android.Widget.Switch)((LinearLayout)cell).GetChildAt(2);
            child0.LayoutChange += (o, e) => {
                // print("AAAAAAAAAAAAAAAAAAAAA-->>");
                SetColorOfToggle(o);
            };
            child0.Click += (o, e) => {
                // CloudStreamForms.Main.print("__> DDAAAAAAAAAAAAA");
                // CloudStreamForms.Main.print("----> " + .Checked);
                SetColorOfToggle(o);
            };
        }
        catch (Exception) {
        }

        //SetColorOfToggle(child0);
        //var child2 = (Android.Widget.Switch)((LinearLayout)child0).GetChildAt(0);
        //  child0.ThumbDrawable.SetColorFilter((child0.Checked ? Android.Graphics.Color.Blue : Android.Graphics.Color.Red), PorterDuff.Mode.Multiply);
        //  var label = (TextView)((LinearLayout)child1).GetChildAt(0);
        // label.SetTextColor(new Android.Graphics.Color(ResourcesCompat.GetColor(context.Resources, Android.Resource.Color.HoloGreenDark, null)));

        return(cell);
    }
Exemplo n.º 3
0
 /// <inheritdoc/>
 public void UnbindFromNative()
 {
     if (switchControl == null)
     {
         return;
     }
     switchControl.CheckedChange -= SwitchControl_CheckedChange;
     switchControl = null;
 }
    protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
    {
        var cell = base.GetCellCore(item, convertView, parent, context);

        cell.FilterTouchesWhenObscured = true;
        cell.SetBackgroundColor(new Android.Graphics.Color(20, 20, 20));
        try {
            Android.Widget.Switch child0 = (Android.Widget.Switch)((LinearLayout)cell).GetChildAt(2);
            child0.LayoutChange += (o, e) => {
                SetColorOfToggle(o);
            };
            child0.Click += (o, e) => {
                SetColorOfToggle(o);
            };
        }
        catch (Exception) {
        }
        return(cell);
    }
Exemplo n.º 5
0
        /// <inheritdoc/>
        public void BindToNative(object nativeView, BindOptions options = BindOptions.None)
        {
            if (nativeView == null)
            {
                throw new ArgumentNullException("nativeView");
            }

            UnbindFromNative();

            switchControl = ViewHelpers.GetView <Android.Widget.Switch> (nativeView);

            if (options.HasFlag(BindOptions.PreserveNativeProperties))
            {
                isChecked = switchControl.Checked;
                enabled   = switchControl.Enabled;
            }
            else
            {
                switchControl.Checked = isChecked;
                switchControl.Enabled = enabled;
            }

            switchControl.CheckedChange += SwitchControl_CheckedChange;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);

            view = inflater.Inflate(Resource.Layout.content_dashboard, null);

            settings = Settings.Instance;

            try
            {
                #region Popup Dialog

                var remoteViews = new RemoteViews(context.PackageName, Resource.Layout.layout_popup);

                var layoutInflater = LayoutInflater.FromContext(context);
                var viewPopup      = layoutInflater.Inflate(remoteViews.LayoutId, null);

                popupDialog = new Dialog(Platform.CurrentActivity);
                popupDialog.SetContentView(viewPopup);
                popupDialog.Window.SetSoftInputMode(SoftInput.AdjustResize);

                var textView = viewPopup.FindViewById <TextView>(Resource.Id.textView1);

                buttonOkPopup        = viewPopup.FindViewById <Button>(Resource.Id.button1);
                buttonOkPopup.Click += ButtonOk_Popup_Click;

                buttonCancelPopup        = viewPopup.FindViewById <Button>(Resource.Id.button2);
                buttonCancelPopup.Click += ButtonCancel_Popup_Click;

                #endregion

                buttonOk        = view.FindViewById <MaterialButton>(Resource.Id.materialButton1);
                buttonOk.Click += async delegate(object sender, EventArgs e) { await ButtonOk_Click(sender, e); };

                buttonCancel        = view.FindViewById <MaterialButton>(Resource.Id.materialButton2);
                buttonCancel.Click += async delegate(object sender, EventArgs e) { await ButtonCancel_Click(sender, e); };

                circularProgress    = view.FindViewById <CircularProgressIndicator>(Resource.Id.circular_progress);
                circularProgressCpu = view.FindViewById <CircularProgressIndicator>(Resource.Id.circular_progress_cpu);
                switchTest          = view.FindViewById <Android.Widget.Switch>(Resource.Id.switch1);
                linearLayout        = view.FindViewById <Android.Widget.LinearLayout>(Resource.Id.bt_linearlayout);

                if (settings.ProVersion == false)
                {
                    switchTest.Touch += SwitchTest_Touch;
                }
                else
                {
                    switchTest.CheckedChange += SwitchTest_CheckedChange;
                }

                Task.Run(() => ProgressIndicatorUpdate());

                cancellationToken = new CancellationTokenSource();

                return(view);
            }
            catch (System.Exception ex)
            {
                #region Logging
                LogRuntimeAttribute.InLogFiles(typeof(DashboardFragment), ex);
                #endregion

                return(view);
            }
            finally { }
        }
Exemplo n.º 7
0
        protected override void OnElementChanged(ElementChangedEventArgs <NewView> e)
        {
            base.OnElementChanged(e);
            if (Control == null)
            {
                //  var context = new NewViewRenderer(Forms.Context);
                //SetNativeControl(context);
                var context = Android.App.Application.Context;
                var view    = LayoutInflater.From(context).Inflate(Resource.Layout.NotificationLayout, null, false);
                //   LayoutInflater minflater = context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater;
                //  var view = minflater.Inflate(Resource.Layout.NotificationLayout, this, false);
                var msgText = view.FindViewById <TextView>(Resource.Id.msgText);
                btnRegion1 = view.FindViewById <Android.Widget.Switch>(Resource.Id.SubscribeToRegion1);
                btnRegion2 = view.FindViewById <Android.Widget.Switch>(Resource.Id.SubscribeToRegion2);
                btnRegion3 = view.FindViewById <Android.Widget.Switch>(Resource.Id.SubscribeToRegion3);
                btnRegion4 = view.FindViewById <Android.Widget.Switch>(Resource.Id.SubscribeToRegion4);
                btnRegion5 = view.FindViewById <Android.Widget.Switch>(Resource.Id.SubscribeToRegion5);
                SetNativeControl(view);

                //show saved settings
                if (Preferences.ContainsKey("R1"))
                {
                    string R1 = Preferences.Get("R1", "");
                    if (R1 == "1")
                    {
                        btnRegion1.Checked = true;
                    }
                    else
                    {
                        btnRegion1.Checked = false;
                    }
                }
                if (Preferences.ContainsKey("R2"))
                {
                    string R2 = Preferences.Get("R2", "");
                    if (R2 == "1")
                    {
                        btnRegion2.Checked = true;
                    }
                    else
                    {
                        btnRegion2.Checked = false;
                    }
                }
                if (Preferences.ContainsKey("R3"))
                {
                    string R3 = Preferences.Get("R3", "");
                    if (R3 == "1")
                    {
                        btnRegion3.Checked = true;
                    }
                    else
                    {
                        btnRegion3.Checked = false;
                    }
                }
                if (Preferences.ContainsKey("R4"))
                {
                    string R4 = Preferences.Get("R4", "");
                    if (R4 == "1")
                    {
                        btnRegion4.Checked = true;
                    }
                    else
                    {
                        btnRegion4.Checked = false;
                    }
                }
                if (Preferences.ContainsKey("R5"))
                {
                    string R5 = Preferences.Get("R5", "");
                    if (R5 == "1")
                    {
                        btnRegion5.Checked = true;
                    }
                    else
                    {
                        btnRegion5.Checked = false;
                    }
                }

                //end remember settings ----------
            }
            if (e.NewElement != null)
            {
                btnRegion1.CheckedChange += (a, b) =>
                {
                    bool isChecked = b.IsChecked;
                    if (isChecked)
                    {
                        FirebaseMessaging.Instance.SubscribeToTopic("R1");
                        Preferences.Set("R1", "1");
                    }
                    else
                    {
                        FirebaseMessaging.Instance.UnsubscribeFromTopic("R1");
                        Preferences.Set("R1", "0");
                    }
                };

                btnRegion2.CheckedChange += (c, d) =>
                {
                    bool isChecked = d.IsChecked;
                    if (isChecked)
                    {
                        FirebaseMessaging.Instance.SubscribeToTopic("R2");
                        Preferences.Set("R2", "1");
                    }
                    else
                    {
                        FirebaseMessaging.Instance.UnsubscribeFromTopic("R2");
                        Preferences.Set("R2", "0");
                    }
                };

                btnRegion3.CheckedChange += (e, f) =>
                {
                    bool isChecked = f.IsChecked;
                    if (isChecked)
                    {
                        FirebaseMessaging.Instance.SubscribeToTopic("R3");
                        Preferences.Set("R3", "1");
                    }
                    else
                    {
                        FirebaseMessaging.Instance.UnsubscribeFromTopic("R3");
                        Preferences.Set("R3", "0");
                    }
                };

                btnRegion4.CheckedChange += (g, h) =>
                {
                    bool isChecked = h.IsChecked;
                    if (isChecked)
                    {
                        FirebaseMessaging.Instance.SubscribeToTopic("R4");
                        Preferences.Set("R4", "1");
                    }
                    else
                    {
                        FirebaseMessaging.Instance.UnsubscribeFromTopic("R4");
                        Preferences.Set("R4", "0");
                    }
                };

                btnRegion5.CheckedChange += (i, j) =>
                {
                    bool isChecked = j.IsChecked;
                    if (isChecked)
                    {
                        FirebaseMessaging.Instance.SubscribeToTopic("R5");
                        Preferences.Set("R5", "1");
                    }
                    else
                    {
                        FirebaseMessaging.Instance.UnsubscribeFromTopic("R5");
                        Preferences.Set("R5", "0");
                    }
                };
            }
        }