Esempio n. 1
0
        public void moreInfoPopup(ObservableCollection <int> selectedSessions, UITableView jobTable, LoggingViewController vc)
        {
            UIAlertController moreInfoSheet;

            moreInfoSheet = UIAlertController.Create(Util.Strings.Job.JOBOPTIONS, "", UIAlertControllerStyle.Alert);

            moreInfoSheet.AddAction(UIAlertAction.Create(Util.Strings.Job.JOBINFO, UIAlertActionStyle.Default, (action) => {
                var jevc    = vc.InflateViewController <JobEditViewController>(BaseIONViewController.VC_EDIT_JOB);
                jevc.frnJID = JID;
                vc.NavigationController.PushViewController(jevc, true);
            }));

            moreInfoSheet.AddAction(UIAlertAction.Create(Util.Strings.SELECTALL, UIAlertActionStyle.Default, (action) => {
                var sessions = ion.database.Query <ION.Core.Database.SessionRow>("SELECT * FROM SessionRow WHERE frn_JID = " + JID);
                foreach (var sesh in sessions)
                {
                    if (!selectedSessions.Contains(sesh.SID))
                    {
                        selectedSessions.Add(sesh.SID);
                    }
                }
                jobTable.ReloadData();
            }));

            moreInfoSheet.AddAction(UIAlertAction.Create(Util.Strings.DESELECTALL, UIAlertActionStyle.Default, (action) => {
                var sessions = ion.database.Query <ION.Core.Database.SessionRow>("SELECT * FROM SessionRow WHERE frn_JID = " + JID);
                foreach (var sesh in sessions)
                {
                    if (selectedSessions.Contains(sesh.SID))
                    {
                        selectedSessions.Remove(sesh.SID);
                    }
                }
                jobTable.ReloadData();
            }));

            moreInfoSheet.AddAction(UIAlertAction.Create(Util.Strings.CANCEL, UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Cancel Action")));
            vc.PresentViewController(moreInfoSheet, true, null);
        }
Esempio n. 2
0
        public ChooseData(UIView containerView, ObservableCollection <int> selected, LoggingViewController vc)
        {
            parentVC = vc;
            DataType = new UIView(new CGRect(0, 55, containerView.Bounds.Width, .8 * containerView.Bounds.Height));
            DataType.BackgroundColor    = UIColor.White;
            DataType.Layer.BorderColor  = UIColor.Black.CGColor;
            DataType.Layer.BorderWidth  = 1f;
            DataType.Layer.CornerRadius = 5;
            DataType.ClipsToBounds      = true;

            selectedSessions = selected;
            cellHeight       = .1f * containerView.Bounds.Height;

            activityLoadingTables = new UIActivityIndicatorView(new CGRect(0, 0, DataType.Bounds.Width, DataType.Bounds.Height));

            ion = AppState.context;

            sessionHeader                 = new UILabel(new CGRect(0, 0, DataType.Bounds.Width, 40));
            sessionHeader.Text            = Util.Strings.Report.SESSIONSELECTION;
            sessionHeader.TextAlignment   = UITextAlignment.Center;
            sessionHeader.Font            = UIFont.BoldSystemFontOfSize(20);
            sessionHeader.BackgroundColor = UIColor.FromRGB(0, 166, 81);

            jobButton = new UIButton(new CGRect(0, 40, .5 * DataType.Bounds.Width, 40));
            jobButton.Layer.BorderColor = UIColor.Black.CGColor;
            jobButton.SetTitle(Util.Strings.Report.BYJOB, UIControlState.Normal);
            jobButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            jobButton.BackgroundColor = UIColor.White;

            jobButton.TouchUpInside += switchJobTab;

            jobHighlight = new UILabel(new CGRect(0, 80, .5 * DataType.Bounds.Width, 5));
            jobHighlight.BackgroundColor = UIColor.FromRGB(0, 174, 239);

            sessionButton = new UIButton(new CGRect(.5 * DataType.Bounds.Width, 40, .5 * containerView.Bounds.Width, 40));
            sessionButton.Layer.BorderColor = UIColor.Black.CGColor;
            sessionButton.SetTitle(Util.Strings.Report.BYDATE, UIControlState.Normal);
            sessionButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            sessionButton.BackgroundColor = UIColor.White;

            sessionButton.TouchUpInside += switchSessionTab;

            sessionHighlight = new UILabel(new CGRect(.5 * DataType.Bounds.Width, 80, .5 * DataType.Bounds.Width, 5));
            sessionHighlight.BackgroundColor = UIColor.Black;

            sessionTable = new UITableView(new CGRect(5, 85, DataType.Bounds.Width - 10, 6.1 * cellHeight));
            sessionTable.RegisterClassForCellReuse(typeof(SessionCell), "sessionCell");
            sessionTable.BackgroundColor    = UIColor.Clear;
            sessionTable.SeparatorStyle     = UITableViewCellSeparatorStyle.None;
            sessionTable.Hidden             = true;
            sessionTable.EstimatedRowHeight = 0;
            refreshSessions = new UIRefreshControl();
            refreshSessions.ValueChanged += (sender, e) => {
                if (!ion.dataLogManager.isRecording)
                {
                    ReloadAllSessions();
                }
            };

            sessionTable.InsertSubview(refreshSessions, 0);
            sessionTable.SendSubviewToBack(refreshSessions);

            jobTable = new UITableView(new CGRect(5, 85, DataType.Bounds.Width - 10, 6.1 * cellHeight));
            jobTable.RegisterClassForCellReuse(typeof(JobCell), "jobCell");
            jobTable.BackgroundColor = UIColor.Clear;
            jobTable.SeparatorStyle  = UITableViewCellSeparatorStyle.None;

            refreshJobs = new UIRefreshControl();
            refreshJobs.ValueChanged += (sender, e) => {
                ReloadAllJobs();
            };
            jobTable.InsertSubview(refreshJobs, 0);
            jobTable.SendSubviewToBack(refreshJobs);

            noJobLabel = new UIButton(new CGRect(0, 90, DataType.Bounds.Width, cellHeight));
            noJobLabel.SetTitle(Util.Strings.Report.NOJOBS, UIControlState.Normal);
            noJobLabel.SetTitleColor(UIColor.Black, UIControlState.Normal);
            noJobLabel.BackgroundColor   = UIColor.FromRGB(255, 215, 101);
            noJobLabel.Layer.BorderWidth = 1f;
            noJobLabel.Hidden            = true;
            noJobLabel.TouchDown        += (sender, e) => { noJobLabel.BackgroundColor = UIColor.Blue; };
            noJobLabel.TouchUpOutside   += (sender, e) => { noJobLabel.BackgroundColor = UIColor.FromRGB(255, 215, 101); };
            noJobLabel.TouchUpInside    += (sender, e) => {
                noJobLabel.BackgroundColor = UIColor.FromRGB(255, 215, 101);
                var jmvc = vc.InflateViewController <JobViewController>(BaseIONViewController.VC_JOB_MANAGER);
                jmvc.pushed = true;
                parentVC.NavigationController.PushViewController(jmvc, true);
            };

            DataType.AddSubview(sessionHeader);
            DataType.AddSubview(jobButton);
            DataType.BringSubviewToFront(jobButton);
            DataType.AddSubview(jobHighlight);
            DataType.AddSubview(sessionButton);
            DataType.BringSubviewToFront(sessionButton);
            DataType.AddSubview(sessionHighlight);
            DataType.AddSubview(jobTable);
            DataType.BringSubviewToFront(jobTable);
            DataType.AddSubview(noJobLabel);
            DataType.AddSubview(sessionTable);
            DataType.BringSubviewToFront(sessionTable);
            DataType.AddSubview(activityLoadingTables);
            DataType.BringSubviewToFront(activityLoadingTables);
            jobButton.SendActionForControlEvents(UIControlEvent.TouchUpInside);
        }
Esempio n. 3
0
        public JobData(int job, string name, UITableView jobTable, nfloat cellHeight, ObservableCollection <int> selectedSessions, LoggingViewController vc)
        {
            ion         = AppState.context;
            selected    = false;
            JID         = job;
            jName       = name;
            jobSessions = new ObservableCollection <SessionData>();

            headerView = new UIView(new CGRect(0, 0, jobTable.Bounds.Width, .8 * cellHeight))
            {
                BackgroundColor = UIColor.Black,
            };

            headerName = new UILabel(new CGRect(0, 0, .9 * jobTable.Bounds.Width, .8 * cellHeight))
            {
                Text                      = jName,
                TextAlignment             = UITextAlignment.Center,
                AdjustsFontSizeToFitWidth = true,
                BackgroundColor           = UIColor.Black,
                TextColor                 = UIColor.White,
            };

            moreInfo = new UIButton(new CGRect(.9 * headerView.Bounds.Width, 0, .1 * headerView.Bounds.Width, .8 * cellHeight));
            moreInfo.Layer.BorderWidth = 1f;
            moreInfo.SetImage(UIImage.FromBundle("ic_more_info"), UIControlState.Normal);
            moreInfo.TouchUpInside += (sender, e) => {
                moreInfoPopup(selectedSessions, jobTable, vc);
            };
            if (JID == 0)
            {
                moreInfo.Hidden = true;
            }

            jobSelect = new UITapGestureRecognizer(() => {
                var sessions = ion.database.Query <ION.Core.Database.SessionRow>("SELECT * FROM SessionRow WHERE frn_JID = " + JID);
                if (selected.Equals(false))
                {
                    selected = true;
                    foreach (var sesh in sessions)
                    {
                        if (!selectedSessions.Contains(sesh.SID))
                        {
                            selectedSessions.Add(sesh.SID);
                        }
                    }
                }
                else
                {
                    selected = false;
                    foreach (var sesh in sessions)
                    {
                        if (selectedSessions.Contains(sesh.SID))
                        {
                            selectedSessions.Remove(sesh.SID);
                        }
                    }
                }
                jobTable.ReloadData();
            });

            headerView.AddSubview(headerName);
            headerView.AddSubview(moreInfo);
            headerView.BringSubviewToFront(moreInfo);
            headerView.AddGestureRecognizer(jobSelect);
        }