Exemplo n.º 1
0
 public CreatedJobSource(List <int> jobs, SetActiveJob chooseActiveJob, JobViewController managerVC = null)
 {
     jobID            = jobs;
     ion              = AppState.context;
     vc               = managerVC;
     clickedJobActive = chooseActiveJob;
 }
Exemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ion = AppState.context;
            // Perform any additional setup after loading the view, typically from a nib.
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("CarbonBackground"));
            AutomaticallyAdjustsScrollViewInsets = false;

            if (!pushed)
            {
                InitNavigationBar("ic_job_settings", false);
                backAction = () => {
                    root.navigation.ToggleMenu();
                };
            }

            Title = Util.Strings.Job.JOBSETTINGS;
            var addJobButton = new UIButton(new CGRect(0, 0, 50, 43));

            addJobButton.TouchUpInside += (sender, e) => {
                var jevc = this.InflateViewController <JobEditViewController>(BaseIONViewController.VC_EDIT_JOB);
                jevc.frnJID = 0;
                this.NavigationController.PushViewController(jevc, true);
            };
            addJobButton.SetImage(UIImage.FromBundle("ic_device_add"), UIControlState.Normal);
            addJobButton.BackgroundColor   = UIColor.FromRGB(255, 215, 101);
            addJobButton.Layer.BorderWidth = 1f;

            var barButton = new UIBarButtonItem(addJobButton);

            NavigationItem.SetRightBarButtonItem(barButton, true);

            ion = AppState.context;
            var jobQuery = ion.database.Query <ION.Core.Database.JobRow>("SELECT DISTINCT JID FROM JobRow ORDER BY JID DESC");

            var jobList = new List <int>();

            foreach (var id in jobQuery)
            {
                jobList.Add(id.JID);
            }
            activeJobChosen += setupActiveJob;
            setupManager(jobList);
        }
Exemplo n.º 3
0
        public void makeCellData(int JobID, double cellWidth, double cellHeight, SetActiveJob chooseActiveJob)
        {
            Console.WriteLine("Get cell called to make celldata");
            ion = AppState.context;
            clickedJobActive = chooseActiveJob;

            jobIDLabel               = new UILabel(new CGRect(5, 5, (.4 * cellWidth) - 5, (.19 * cellHeight) - 5));
            jobIDLabel.Text          = "Job ID:";
            jobIDLabel.Font          = UIFont.BoldSystemFontOfSize(15f);
            jobNameLabel             = new UILabel(new CGRect(5, (.19 * cellHeight) + 5, (.4 * cellWidth) - 5, (.19 * cellHeight) - 5));
            jobNameLabel.Text        = Util.Strings.Job.JOBNAME + ":";
            jobNameLabel.Font        = UIFont.BoldSystemFontOfSize(15f);
            customerNumberLabel      = new UILabel(new CGRect(5, (.38 * cellHeight) + 5, (.4 * cellWidth) - 5, (.19 * cellHeight) - 5));
            customerNumberLabel.Text = Util.Strings.Job.CUSTOMERSIGN + ":";
            customerNumberLabel.Font = UIFont.BoldSystemFontOfSize(15f);
            dispatchNumberLabel      = new UILabel(new CGRect(5, (.57 * cellHeight) + 5, (.4 * cellWidth) - 5, (.19 * cellHeight) - 5));
            dispatchNumberLabel.Text = Util.Strings.Job.DISPATCHSIGN + ":";
            dispatchNumberLabel.Font = UIFont.BoldSystemFontOfSize(15f);
            poNumberLabel            = new UILabel(new CGRect(5, (.76 * cellHeight) + 5, (.4 * cellWidth) - 5, (.19 * cellHeight) - 5));
            poNumberLabel.Text       = Util.Strings.Job.POSIGN + ":";
            poNumberLabel.Font       = UIFont.BoldSystemFontOfSize(15f);

            idValueLabel       = new UILabel(new CGRect(.4 * cellWidth, 5, .4 * cellWidth, (.19 * cellHeight) - 5));
            nameValueLabel     = new UILabel(new CGRect(.4 * cellWidth, (.19 * cellHeight) + 5, .4 * cellWidth, (.19 * cellHeight) - 5));
            customerValueLabel = new UILabel(new CGRect(.4 * cellWidth, (.38 * cellHeight) + 5, .4 * cellWidth, (.19 * cellHeight) - 5));
            dispatchValueLabel = new UILabel(new CGRect(.4 * cellWidth, (.57 * cellHeight) + 5, .4 * cellWidth, (.19 * cellHeight) - 5));
            poValueLabel       = new UILabel(new CGRect(.4 * cellWidth, (.76 * cellHeight) + 5, .4 * cellWidth, (.19 * cellHeight) - 5));

            editJobImage = new UIButton(new CGRect(.84 * cellWidth, .25 * cellHeight, .5 * cellHeight, .5 * cellHeight));
            editJobImage.SetImage(UIImage.FromBundle("ic_bookmark").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal);

            if (JobID == ion.preferences.jobs.activeJob)
            {
                editJobImage.TintColor = UIColor.Yellow;
            }
            else
            {
                editJobImage.TintColor = UIColor.Black;
            }

            editJobImage.BackgroundColor    = UIColor.FromRGB(255, 215, 101);
            editJobImage.Layer.CornerRadius = 5f;
            editJobImage.ContentMode        = UIViewContentMode.Center;

            editJobImage.TouchUpInside += (sender, e) => {
                if (ion.preferences.jobs.activeJob == JobID)
                {
                    Console.WriteLine("Unhooking job id " + JobID + " as active job");
                    ion.preferences.jobs.activeJob = 0;
                    editJobImage.TintColor         = UIColor.Black;
                }
                else
                {
                    Console.WriteLine("Setting active job to " + JobID);
                    ion.preferences.jobs.activeJob = JobID;
                    editJobImage.TintColor         = UIColor.Yellow;
                }
                clickedJobActive();
            };

            var jobQuery = ion.database.Query <ION.Core.Database.JobRow>("SELECT * FROM JobRow WHERE JID = ?", JobID);

            foreach (var job in jobQuery)
            {
                idValueLabel.Text       = job.JID.ToString();
                nameValueLabel.Text     = job.jobName;
                customerValueLabel.Text = job.customerNumber;
                dispatchValueLabel.Text = job.dispatchNumber;
                poValueLabel.Text       = job.poNumber;
            }

            this.AddSubview(jobIDLabel);
            this.AddSubview(jobNameLabel);
            this.AddSubview(customerNumberLabel);
            this.AddSubview(dispatchNumberLabel);
            this.AddSubview(poNumberLabel);

            this.AddSubview(idValueLabel);
            this.AddSubview(nameValueLabel);
            this.AddSubview(customerValueLabel);
            this.AddSubview(dispatchValueLabel);
            this.AddSubview(poValueLabel);

            this.AddSubview(editJobImage);
        }