コード例 #1
0
        void ReleaseDesignerOutlets()
        {
            if (BatteryLevel1 != null)
            {
                BatteryLevel1.Dispose();
                BatteryLevel1 = null;
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (StopSessionButton != null)
            {
                StopSessionButton.Dispose();
                StopSessionButton = null;
            }
        }
コード例 #2
0
        void ReleaseDesignerOutlets()
        {
            if (BluetoothButton != null)
            {
                BluetoothButton.Dispose();
                BluetoothButton = null;
            }

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

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

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

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

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

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

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

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

            if (TopBar != null)
            {
                TopBar.Dispose();
                TopBar = null;
            }
        }
コード例 #3
0
ファイル: IphoneMainView.cs プロジェクト: ominux/Wireless_MA
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            BluetoothViewObj.NFCScanButtonOutlet.TouchDown  += Scan;
            NavigationController.NavigationBar.TopItem.Title = "AM Monitor";

            BluetoothButton.SetTitleColor(UIColor.FromRGBA(82, 99, 227, 175), UIControlState.Normal);
            DashboardButton.SetTitleColor(UIColor.FromRGBA(82, 99, 227, 255), UIControlState.Normal);
            DashboardButton.Font = UIFont.BoldSystemFontOfSize(17.0f);
            BluetoothButton.Font = UIFont.SystemFontOfSize(17.0f);

            BluetoothViewObj.Hidden = true;
            DownloadViewObj.Hidden  = true;

            var set = this.CreateBindingSet <IphoneMainView, MainViewModel>();
            BluetoothTableViewSource DeviceListSource         = new BluetoothTableViewSource(BluetoothViewObj.DevicesTableViewOutlet);
            DownloadTableViewSource  DownloadDeviceListSource = new DownloadTableViewSource(DownloadViewObj.DeviceTable);

            set.Bind(DeviceListSource).To(vm => vm.ScannedDevices);
            set.Bind(DownloadDeviceListSource).To(vm => vm.DownloadDevices);
            set.Bind(BluetoothButton).To(vm => vm.ScanRequested);
            set.Bind(BluetoothViewObj.RefreshButtonOutlet).To(vm => vm.ScanRequested);

            SessionStatus1.Text = "-";
            SessionStatus2.Text = "-";
            BatteryLevel1.Text  = "-";
            BatteryLevel2.Text  = "-";

            SessionStringValueConverter sessionConverter = new SessionStringValueConverter();
            BatteryStringValueConverter batteryConverter = new BatteryStringValueConverter();

            set.Bind(SessionStatus1).To(vm => vm.Slot1.SessionStatus).WithConversion(sessionConverter).For("Text");
            set.Bind(SessionStatus2).To(vm => vm.Slot2.SessionStatus).WithConversion(sessionConverter).For("Text");
            set.Bind(BatteryLevel1).To(vm => vm.Slot1.BatteryLevel).WithConversion(batteryConverter).For("Text");
            set.Bind(BatteryLevel2).To(vm => vm.Slot2.BatteryLevel).WithConversion(batteryConverter).For("Text");

            set.Bind(DownloadViewObj.EmptyStateLabelOutlet)
            .To(vm => vm.DownloadViewModel.SlotsAreEmpty).For("Hidden")
            .WithDictionaryConversion(new Dictionary <bool, bool>
            {
                { true, false },
                { false, true },
            });

            ScanStringValueConverter refreshStringConverter = new ScanStringValueConverter();

            set.Bind(BluetoothViewObj.RefreshButtonOutlet)
            .To(vm => vm.IsRefreshing.IsRefreshingList).For("Title")
            .WithConversion(refreshStringConverter).OneWay();
            set.Bind(BluetoothViewObj.RefreshButtonOutlet)
            .To(vm => vm.IsRefreshing.IsRefreshingList).For("Enabled");

            BluetoothViewObj.DevicesTableViewOutlet.RegisterNibForCellReuse(BluetoothTableViewCell.Nib, "BluetoothTableViewCell");
            BluetoothViewObj.DevicesTableViewOutlet.Source = DeviceListSource;

            DownloadViewObj.DeviceTable.RegisterNibForCellReuse(DownloadCell.Nib, "DownloadCell");
            DownloadViewObj.DeviceTable.Source = DownloadDeviceListSource;

            List <SFChart> graphs = new List <SFChart> {
                GraphViewObj1, GraphViewObj3
            };

            foreach (var graph in graphs)
            {
                SetSfChart(graph);
                AddLegend(graph);
                for (int i = 0; i < 3; i++)
                {
                    AddSeries(graph);
                }
                graph.Layer.CornerRadius = 4f;
            }

            // Accelerometer
            set.Bind(GraphViewObj1.SeriesAtIndex(0))
            .To(vm => vm.DataList["0_accl_x"])
            .For(v => v.ItemsSource);
            GraphViewObj1.SeriesAtIndex(0).Color = UIColor.FromRGBA(46, 68, 222, 255);
            GraphViewObj1.SeriesAtIndex(0).Label = "X";

            set.Bind(GraphViewObj1.SeriesAtIndex(1))
            .To(vm => vm.DataList["0_accl_y"])
            .For(v => v.ItemsSource);
            GraphViewObj1.SeriesAtIndex(1).Color = UIColor.FromRGBA(88, 194, 99, 255);
            GraphViewObj1.SeriesAtIndex(1).Label = "Y";

            set.Bind(GraphViewObj1.SeriesAtIndex(2))
            .To(vm => vm.DataList["0_accl_z"])
            .For(v => v.ItemsSource);
            GraphViewObj1.SeriesAtIndex(2).Color = UIColor.FromRGBA(182, 47, 220, 255);
            GraphViewObj1.SeriesAtIndex(2).Label = "Z";

            // Accelerometer
            set.Bind(GraphViewObj3.SeriesAtIndex(0))
            .To(vm => vm.DataList["1_accl_x"])
            .For(v => v.ItemsSource);
            GraphViewObj3.SeriesAtIndex(0).Color = UIColor.FromRGBA(46, 68, 222, 255);
            GraphViewObj3.SeriesAtIndex(0).Label = "X";

            set.Bind(GraphViewObj3.SeriesAtIndex(1))
            .To(vm => vm.DataList["1_accl_y"])
            .For(v => v.ItemsSource);
            GraphViewObj3.SeriesAtIndex(1).Color = UIColor.FromRGBA(88, 194, 99, 255);
            GraphViewObj3.SeriesAtIndex(1).Label = "Y";

            set.Bind(GraphViewObj3.SeriesAtIndex(2))
            .To(vm => vm.DataList["1_accl_z"])
            .For(v => v.ItemsSource);
            GraphViewObj3.SeriesAtIndex(2).Color = UIColor.FromRGBA(182, 47, 220, 255);
            GraphViewObj3.SeriesAtIndex(2).Label = "Z";

            List <UIButton> eventButtons = new List <UIButton> {
                EventButton1, EventButton2, EventButton3, EventButton4,
                EventButton5, EventButton6, EventButton7, EventButton8,
                StartSessionButton, StopSessionButton
            };

            foreach (var button in eventButtons)
            {
                button.Layer.CornerRadius = 4f;
            }
            set.Bind(EventButton1).To(vm => vm.LogEvent1);
            set.Bind(EventButton2).To(vm => vm.LogEvent2);
            set.Bind(EventButton3).To(vm => vm.LogEvent3);
            set.Bind(EventButton4).To(vm => vm.LogEvent4);
            set.Bind(EventButton5).To(vm => vm.LogEvent5);
            set.Bind(EventButton6).To(vm => vm.LogEvent6);
            set.Bind(EventButton7).To(vm => vm.LogEvent7);
            set.Bind(EventButton8).To(vm => vm.LogEvent8);


            set.Bind(StartSessionButton).To(vm => vm.StartSession);
            set.Bind(StopSessionButton).To(vm => vm.StopSession);
            set.Bind(DownloadButton).To(vm => vm.TryStopSession);

            set.Apply();
        }