コード例 #1
0
        public NewSignatureViewController(DetailedTabs tabs) : base()
        {
            this.Tabs = tabs;
            // PDFView = new UIWebView(new RectangleF(0,20,703,748));
            pdfView = new UIWebView(new CGRect(0, 64, 703, 448));                //(20,40,663,448));

            Signature = new GLSignatureView(new CGRect(0, 516, 743, 150), this); // new BezierSignatureView
        }
コード例 #2
0
ファイル: Memos.cs プロジェクト: DmitryNadezhdin/ipad-puratap
 public Memos(DetailedTabs tabs) : base("Memos", null)
 {
     this.Title = NSBundle.MainBundle.LocalizedString("Memos", "Memos");
     using (var image = UIImage.FromBundle("Images/179-notepad")) this.TabBarItem.Image = image;
     this._memos      = new List <Memo> ();
     this._memoSource = new MemoTableSource(this);
     this._tabs       = tabs;
 }
コード例 #3
0
        public JobHistoryViewController(DetailedTabs tabs) : base("JobHistoryViewController", null)
        {
            this.Title = NSBundle.MainBundle.LocalizedString("Job History", "Job History");
            using (var image = UIImage.FromBundle("Images/104-index-cards")) this.TabBarItem.Image = image;

            this._tabs = tabs;

            JobHistoryData = new JobHistoryDataModel(this);
            _ds            = new JobHistoryTableSource(this);
        }
コード例 #4
0
            public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
            {
                DetailedTabs dvc = svc.ViewControllers[1] as DetailedTabs;

                if (dvc != null)
                {
                    // if we can get the detailed tabs controller, undo all the changes made when orientation changed last time
                    dvc.View.Frame = new CoreGraphics.CGRect(0, 0, 703, 748);                                   // set the frame to old size
                    dvc.RemoveLeftNavBarButton();                                                               // remove navigation bar button
                    // dvc.NavigationBar.Frame = new System.Drawing.RectangleF(0, 0, dvc.View.Bounds.Width, 44);
                    dvc.Popover = null;                                                                         // remove popover controller link
                }
            }
コード例 #5
0
        public SignatureViewController(DetailedTabs tabs) : base("SignatureViewController", null)
        {
            this._tabs = tabs;

            PDFView = new UIWebView(new CGRect(0, 20, 703, 748));

            ToolbarItems = new UIBarButtonItem[] {
                new UIBarButtonItem(UIBarButtonSystemItem.Reply),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Bordered, StartSigning()),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem(UIBarButtonSystemItem.Action)
            };
        }
コード例 #6
0
        {               // this defines split controller behavior in case of device orientation changes
            public override void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
            {
                DetailedTabs dvc = svc.ViewControllers[1] as DetailedTabs;

                if (dvc != null)
                {
                    // defines the new frame for right side view controller which should now take up the entire screen space
                    dvc.View.Frame = new CoreGraphics.CGRect(0, 0, 768, 1004);

                    // adds a button which will show the left side table with customers data when tapped
                    dvc.AddLeftNavBarButton(barButtonItem);

                    // defines a navigation frame for the navigation bar
                    dvc.MyNavigationBar.Frame = new CoreGraphics.CGRect(0, 0, dvc.View.Bounds.Width, 44);

                    // set up the popover view controller ( JobRunTable )
                    dvc.Popover = pc;
                }
            }
コード例 #7
0
 public CustomersViewController(DetailedTabs tabs) : base("CustomersViewController", null)
 {
     this.Title = NSBundle.MainBundle.LocalizedString("Customer", "Customer");
     using (var image = UIImage.FromBundle("Images/111-user")) this.TabBarItem.Image = image;
     this._tabs = tabs;
 }
コード例 #8
0
 public CustomerNavigationController(DetailedTabs tabs)
 {
     Tabs = tabs;
 }
コード例 #9
0
 public PaymentsSummaryNavigationController(DetailedTabs tabs) : base()
 {
     Tabs = tabs;
     NavigationBarHidden = true;
 }
コード例 #10
0
        public SigningNavigationController(DetailedTabs tabs)
        {
            Tabs = tabs;

            this.NavigationBar.BarStyle = UIBarStyle.Default;             // .Black;
        }
コード例 #11
0
 public RunRouteNavigationController(DetailedTabs tabs) : base()
 {
     Tabs = tabs;
 }
コード例 #12
0
        public SignDailyStockUsed(DetailedTabs tabs) : base(tabs)
        {
            // todo :: EXCEPTION HANDLING here

            // fill the DVC property here with the stock details
            dvc = new DialogViewController(new RootElement("Used stock"));
            dvc.Root.Add(new Section(""));

            if (File.Exists(ServerClientViewController.dbFilePath))
            {
                // read the data from database here
                using (var connection = new SqliteConnection("Data Source=" + ServerClientViewController.dbFilePath))
                {
                    try
                    {
                        using (var cmd = connection.CreateCommand())
                        {
                            connection.Open();
                            cmd.CommandText = "SELECT su.Element_Type as Type, su.Element_OID as ID, p.Part_Desc as Desc, SUM(su.Num_Used) as USED_TODAY " +
                                              "FROM STOCKUSED su, PARTS p " +
                                              "WHERE su.Element_OID = p.Part_ID  " +
                                              "AND su.Element_Type = 'P'  " +
                                              "GROUP BY Element_Type, Element_OID, Part_Desc " +
                                              "UNION SELECT su.Element_Type as Type, su.Element_OID as ID, a.Name as Desc, SUM(su.Num_Used) as USED_TODAY " +
                                              "FROM STOCKUSED su, ASSEMBLIES a " +
                                              "WHERE su.Element_OID = a.Assembly_ID  " +
                                              "AND su.Element_Type = 'A'  " +
                                              "GROUP BY Element_Type, Element_OID, Name";
                            using (var reader = cmd.ExecuteReader())
                            {
                                while (reader.Read())
                                {
                                    string id          = (string)(reader["type"]) + Convert.ToString(reader["id"]);
                                    string description = (string)reader["desc"];
                                    double used        = Convert.ToDouble(reader["used_today"]);

                                    dvc.Root[0].Add(new StyledStringElement(
                                                        id + " " + description,
                                                        used.ToString(),
                                                        UITableViewCellStyle.Value1));
                                }
                                if (!reader.IsClosed)
                                {
                                    reader.Close();
                                }
                            }
                        }
                    }
                    catch (Exception e) {
                        // Console.WriteLine (e.Message);
                    }
                }
            }
            GenerateStockUsedPDFPreview();
            RedrawDailyStockPDF(false);

            GoBack = delegate {
                if (SigningMode)
                {
                    FinishSigning(null, null);
                    hasBeenSigned = false;
                }
                this.NavigationController.PopToRootViewController(true);
            };

            GoForward = delegate {
                if (this.hasBeenSigned)
                {
                    this.NavigationController.SetNavigationBarHidden(true, false);
                    this.NavigationController.PopToRootViewController(true);

                    this.Tabs._scView.StartNewDataExchange();
                    // this.Tabs._scView.InitDataExchange ();
                }
                else
                {
                    var alert = new UIAlertView("", "Please finish signing the document first", null, "OK");
                    alert.Show();
                }
            };


            ClearSignature = delegate {
                // Signature.Image = new UIImage();
                Signature.Clear();
                hasBeenSigned = false;
            };


            StartSigning = delegate {
                signing = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning);
                this.SetToolbarItems(new UIBarButtonItem[] {
                    back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    clearSignature, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    forward
                }, true);

                // Signature.Image = new UIImage();
                Signature.Clear();
                hasBeenSigned = false;
                SigningMode   = true;
            };

            FinishSigning = delegate {
                SigningMode = false;
                signing     = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Bordered, StartSigning);

                this.SetToolbarItems(new UIBarButtonItem[] {
                    back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    forward
                }, true);

                UIImageView iv = new UIImageView();
                iv             = (UIImageView)GeneratedPDFView.ViewWithTag(4);
                iv.ContentMode = UIViewContentMode.ScaleAspectFit;
                UIImage im = Signature.GetDrawingImage();                  // this.Signature.Image;

                iv.Image = im;

                if (hasBeenSigned)
                {
                    RedrawDailyStockPDF(true);

                    CGPoint offset = new CGPoint(0, this.PDFView.ScrollView.ContentSize.Height - this.PDFView.ScrollView.Bounds.Height);
                    PDFView.ScrollView.SetContentOffset(offset, true);
                    // Signature.Image = new UIImage();
                    Signature.Clear();
                }

                iv.Dispose();  im.Dispose();
                im = null; iv = null;
            };

            back           = new UIBarButtonItem(UIBarButtonSystemItem.Reply);
            signing        = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Plain, StartSigning);
            forward        = new UIBarButtonItem(UIBarButtonSystemItem.Action);
            clearSignature = new UIBarButtonItem("Clear signature", UIBarButtonItemStyle.Plain, ClearSignature);

            ToolbarItems = new UIBarButtonItem[] {
                back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                forward
            };

            back.Clicked    += GoBack;
            forward.Clicked += GoForward;
        }
コード例 #13
0
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have approximately 17 seconds to return from this method, or iOS will terminate your application.
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Xamarin.Insights.Initialize("20b7565ad9a4eee1d56492b26841b0bf70fbb5ed");
            Xamarin.Insights.Identify(MyConstants.DeviceID, MyConstants.EmployeeID.ToString(), MyConstants.EmployeeName);
            // MonoTouch.TestFlight.TestFlight.TakeOffThreadSafe("f1e1ead5-5ee8-4a3c-a52b-a18e7919b06d");
            InitializeLocationObjects();

            // if database file does not exist, copy test database from app bundle to /Documents folder so that we can edit it

            // DEBUG :: if (! File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "NEWTESTDB.sqlite")) )
            {
                File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "NEWTESTDB.sqlite"));
                string _from = Path.Combine(NSBundle.MainBundle.BundlePath, "NEWTESTDB.sqlite");
                string _to   = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "NEWTESTDB.sqlite");
                File.Copy(_from, _to);

                if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Franchisee Training Manual.pdf")))
                {
                    File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Franchisee Training Manual.pdf"));
                }
                _from = Path.Combine(NSBundle.MainBundle.BundlePath, "Franchisee Training Manual.pdf");
                _to   = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Franchisee Training Manual.pdf");
                File.Copy(_from, _to);
            }
            // create a new window instance based on the screen size
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            // create a tableview that will contain the jobs (left side)
            _jobs = new JobRunTable(UITableViewStyle.Grouped);

            // create the tabcontroller that defines and handles the tabs (rightside)
            _tabs       = new DetailedTabs(_jobs, this);
            _tabs.Title = "Puratap " + MyConstants.AppVersion;

            // link the two above controllers
            _jobs._tabs        = _tabs;
            _tabs._jobRunTable = _jobs;

            _navTabs = new UINavigationController(_tabs);
            _navTabs.NavigationBar.BarStyle    = UIBarStyle.Black;
            _navTabs.NavigationBar.Translucent = true;


            // create a split controller that will hold the two above controllers
            _split = new UISplitViewController();

            // add _jobs and _tabs to split view controller
            _split.ViewControllers = new UIViewController[] {
                _jobs,
                _navTabs                 // _tabs
            };

            _split.Delegate = new SplitDelegate();

            // make the split controller the root (main) application controller
            window.RootViewController = _split;

            // ?? DEBUG
//			try {
//				NSUrl url = (NSUrl) options.ValueForKey (UIApplication.LaunchOptionsUrlKey);
//				if (url != null)
//				{
//					// Console.WriteLine (url.Path);
//				}
//			}
//			catch {}


            // if database file exists, check its integrity
            try {
                if (File.Exists(MyConstants.DBReceivedFromServer))
                {
                    if (_tabs._jobRunTable._ds.TestDBIntegrity())
                    {
                        // HACK temporary transitional code for updating from version 1.3c to 1.3d
                        // 1.3d requires IPAD_ORDERING field in PL_RECOR table
                        // some of the databases may not contain it if they were exported before the change was implemented

                        // check if "IPAD_ORDERING" field exists in database
                        string dbPath = MyConstants.DBReceivedFromServer;
                        using (var dbCon = new SqliteConnection("Data Source=" + dbPath)) {
                            dbCon.Open();
                            using (var cmd = dbCon.CreateCommand()) {
                                string sql = " SELECT IPAD_ORDERING FROM PL_RECOR ";
                                cmd.CommandText = sql;
                                try {
                                    using (var reader = cmd.ExecuteReader()) {
                                        if (reader.HasRows)
                                        {
                                            // db is good, the IPAD_ORDERING field exists
                                        }
                                    }
                                } catch {
                                    // IPAD_ORDERING field does not exists, we need to add it
                                    cmd.Parameters.Clear();
                                    cmd.CommandText = "ALTER TABLE PL_RECOR ADD COLUMN IPAD_ORDERING INTEGER NULL DEFAULT 9999";
                                    cmd.ExecuteNonQuery();
                                    cmd.CommandText = "UPDATE PL_RECOR SET IPAD_ORDERING = 9999";
                                    cmd.ExecuteNonQuery();
                                }
                            }                     // end using dbCommand
                        }                         // end using dbConnection
                                                  // END HACK this code should be removed on 08.11.2013

                        // if database integrity check went ok, load customers and jobs from it
                        _tabs._jobRunTable._ds.LoadJobRun(1);
                    }
                    else
                    {
                        var integrityCheckFailedAlert = new UIAlertView("Database integrity check failed", "Try loading the data anyway? (App may crash if you choose 'Yes')", null, "No", "Yes");
                        integrityCheckFailedAlert.Dismissed += delegate(object sender, UIButtonEventArgs e) {
                            if (e.ButtonIndex != integrityCheckFailedAlert.CancelButtonIndex)
                            {
                                _tabs._jobRunTable._ds.LoadJobRun(1);
                            }
                        };
                        this.InvokeOnMainThread(delegate {
                            integrityCheckFailedAlert.Show();
                        });
                    }
                }
                else
                {
                    // db file does not exist
                    var dbNotfound = new UIAlertView("Database file not found", "Please complete the data exchange with the server.", null, "OK");
                    this.InvokeOnMainThread(delegate { dbNotfound.Show(); });
                }
            }
            finally
            {
                window.MakeKeyAndVisible();
            }
            return(true);
        }
コード例 #14
0
        public SignInvoiceViewController(DetailedTabs tabs) : base(tabs)
        {
            this.Title = "Sign receipt";
            using (var image = UIImage.FromBundle("Images/187-pencil")) this.TabBarItem.Image = image;
            this.NavigationItem.HidesBackButton = true;

            GoBack = delegate {
                if (SigningMode)
                {
                    FinishSigning(null, null);
                    hasBeenSigned = false;
                }

                // if service should be signed, push service
                bool ShouldSignService = false;
                Job  main = (Tabs._jobRunTable.CurrentJob.HasParent()) ?  Tabs._jobRunTable.FindParentJob(Tabs._jobRunTable.CurrentJob) : Tabs._jobRunTable.CurrentJob;

                if (main.JobReportAttached)
                {
                    ShouldSignService = true;
                }
                foreach (Job child in main.ChildJobs)
                {
                    if (child.JobReportAttached)
                    {
                        ShouldSignService = true;
                    }
                    break;
                }

                /*
                 * if (main.Type.Code == "SER") ShouldSignService = true;
                 * foreach(Job child in main.ChildJobs)
                 *      if (child.Type.Code == "SER") ShouldSignService = true;
                 */

                if (ShouldSignService)
                {
                    Tabs.SigningNav.PopToRootViewController(false);
                    Tabs.SigningNav.PushViewController(Tabs.SignService, true);
                }

                // else if pre-plumbing should be signed, push pre-plumbing
                else if (!Tabs._prePlumbView.IsDefault())
                {
                    // push pre-plumbing check
                    Tabs.SigningNav.PopToRootViewController(false);
                    Tabs.SigningNav.PushViewController(Tabs.SignPre, true);
                }
                else                            // otherwise, return back to payment screen
                {
                    Tabs.SigningNav.PopToRootViewController(false);
                    Tabs.SelectedViewController = Tabs.ViewControllers[Tabs.LastSelectedTab];
                }
            };

            GoForward = delegate {
                if ((this.hasBeenSigned && !SigningMode) || SkippedSigning)
                {
                    //string currentNetwork = MyConstants.GetCurrentWiFiNetworkID ();
                    //bool networkOK = (currentNetwork == "247");
                    //this.Tabs._scView.Log (String.Format("Current network returned by MyConstants.GetCurrentWiFiNetworkID : {0}", currentNetwork));

                    //networkOK = true; // debug

                    if (true)                     // networkOK
                    {
                        // AllPrintingDone.Reset ();

                        BeginPrinting();
                        // this starts a new thread to handle the printing task
                    }

                    /*
                     * else
                     * {
                     *      // we're connected to another network, alert the user
                     *      var networkAlert = new UIAlertView( String.Format("Your iPad is connected to \"{0}\"", "currentNetwork"),
                     *                                  "You have to go to Settings -> Wi-Fi and connect to printer network (\"247\") for printing to work. What would you like to do?", null,
                     *                                  "Skip printing", "Change network");
                     *      networkAlert.Dismissed += HandleNetworkAlertDismissed;
                     *      networkAlert.Show ();
                     * }
                     */
                }
                else
                {
                    var alert = new UIAlertView("", "Please finish signing the document first", null, "OK");
                    alert.Show();
                }

                if (SkippedSigning)
                {
                    // Here we should take whatever measures to somehow record that the receipt has not been signed by the customer
                    SkippedSigning = false;
                }
            };

            ClearSignature = delegate {
                // Signature.Image = new UIImage();
                Signature.Clear();
                hasBeenSigned = false;
            };

            SkipSigning = delegate {
                skipAlert            = new UIAlertView("Are you sure?", "The receipt will be printed out without the customer signature.", null, "No, never mind", "Yes, please");
                skipAlert.Dismissed += HandleSkipAlertDismissed;
                skipAlert.Show();
            };

            StartSigning = delegate {
                signing = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning);
                this.SetToolbarItems(new UIBarButtonItem[] {
                    back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    clearSignature, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    skipSigning, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    forward
                }, true);

                Signature.Clear();
                hasBeenSigned = false;
                SigningMode   = true;

                this.NavigationController.SetNavigationBarHidden(false, true);
                this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem("Clear Signature", UIBarButtonItemStyle.Plain, ClearSignature), true);
                this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning), true);

//				this.NavigationItem.SetRightBarButtonItems (new UIBarButtonItem[] {
//					new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning),
//					new UIBarButtonItem("Clear Signature", UIBarButtonItemStyle.Bordered, ClearSignature) }, true);

                this.NavigationController.SetToolbarHidden(true, true);
            };

            FinishSigning = delegate {
                SigningMode = false;
                signing     = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Plain, StartSigning);

                this.SetToolbarItems(new UIBarButtonItem[] {
                    back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    email, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    skipSigning, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    forward
                }, true);

                this.NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { }, true);
                this.NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] { }, true);
                this.NavigationController.SetToolbarHidden(false, true);

                UIImageView iv = new UIImageView();
                iv             = (UIImageView)Tabs._payment.GeneratedPdfView.ViewWithTag(MyConstants.ReceiptPDFTemplateTags.Signature);
                iv.ContentMode = UIViewContentMode.ScaleAspectFit;
                UIImage im = Signature.GetDrawingImage();                  // this.Signature.Image;
                iv.Image = im;

                if (hasBeenSigned)
                {
                    PDFView.ScrollView.ScrollsToTop = false;
                    Tabs._payment.RedrawReceiptPDF(true);
                    // Signature.Image = new UIImage();
                    Signature.Clear();
                }

                if (iv != null)
                {
                    iv.Dispose(); iv = null;
                }
                if (im != null)
                {
                    im.Dispose(); im = null;
                }
            };

            DoSendReceiptEmail = delegate {
                if (MFMailComposeViewController.CanSendMail)
                {
                    // check if there is an existing email address on file
                    string existingEmail = Tabs._jobRunTable.CurrentCustomer.EmailAddress;
                    if (ValidateEmailAddress(existingEmail))
                    {
                        // there is an email address on file
                        var alertUseExistingEmail = new UIAlertView("Use this email address?", existingEmail, null, "No", "Yes");
                        alertUseExistingEmail.Dismissed += delegate(object sender, UIButtonEventArgs e) {
                            if (e.ButtonIndex == 1)
                            {
                                // user confirmed using existing email
                                emailRecepients = existingEmail;
                                SaveEmailAndPresentMailComposingView();
                            }
                            else
                            {
                                // user declined using existing email, collect email address
                                PresentGetEmailAddressView();
                            }
                        };
                        alertUseExistingEmail.Show();
                    }
                    else
                    {
                        // collect email address
                        PresentGetEmailAddressView();
                    }
                }
                else
                {
                    var alertCannotSendEmails = new UIAlertView("", "It seems like this iPad cannot send e-mails at the time. Please check the network settings and try again", null, "OK");
                    alertCannotSendEmails.Show();
                }
            };

            back           = new UIBarButtonItem(UIBarButtonSystemItem.Reply);
            signing        = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Plain, StartSigning);
            email          = new UIBarButtonItem("Email receipt", UIBarButtonItemStyle.Plain, DoSendReceiptEmail);
            skipSigning    = new UIBarButtonItem("Skip signing", UIBarButtonItemStyle.Plain, SkipSigning);
            forward        = new UIBarButtonItem(UIBarButtonSystemItem.Action);
            clearSignature = new UIBarButtonItem("Clear signature", UIBarButtonItemStyle.Plain, ClearSignature);

            ToolbarItems = new UIBarButtonItem[] {
                back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                email, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                skipSigning, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                forward
            };

            back.Clicked    += GoBack;
            forward.Clicked += GoForward;
        }
 public PrePlumbingCheckNavigationController(DetailedTabs tabs) : base()
 {
     Tabs = tabs;
 }
コード例 #16
0
 public RunRouteViewController(DetailedTabs tabs) : base("RunRouteViewController", null)
 {
     Tabs       = tabs;
     this.Nav   = Tabs.RunRouteNav;
     this.Title = "Run route";
 }
コード例 #17
0
 public JobSummary(WorkflowNavigationController nav, DetailedTabs tabs, RootElement root, bool pushing) : base(root, pushing)
 {
     Nav   = nav;
     _tabs = tabs;
 }
コード例 #18
0
        public SignServiceReportViewController(DetailedTabs tabs) : base(tabs)
        {
            this.Title = "Sign service report";
            using (var image = UIImage.FromBundle("Images/187-pencil")) this.TabBarItem.Image = image;
            this.NavigationItem.HidesBackButton = true;

            GoBack = delegate {
                if (SigningMode)
                {
                    FinishSigning(null, null);
                    hasBeenSigned = false;
                }
                if (!Tabs._prePlumbView.IsDefault())
                {
                    // push pre-plumb signing
                    Tabs.SigningNav.PopToRootViewController(false);
                    Tabs.SigningNav.PushViewController(Tabs.SignPre, true);
                }
                else
                {
                    Tabs.SelectedViewController = Tabs.ViewControllers[Tabs.LastSelectedTab];
                }
            };

            GoForward = delegate {
                if (this.hasBeenSigned && !SigningMode)
                {
                    if (Tabs.SignInvoice != null)
                    {
                        Tabs.SigningNav.PushViewController(Tabs.SignInvoice, true);
                        // Tabs.SigningNav.InvoicePushed = true;
                    }
                    else
                    {
                        Tabs._navWorkflow._finishWorkflow(null, null);
                    }
                }
                else
                {
                    var alert = new UIAlertView("", "Please finish signing the document first", null, "OK");
                    alert.Show();
                }
            };

            ClearSignature = delegate {
                // Signature.Image = new UIImage();
                Signature.Clear();
                hasBeenSigned = false;
            };

            StartSigning = delegate {
                signing = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning);
                this.SetToolbarItems(new UIBarButtonItem[] {
                    back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    clearSignature, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    forward
                }, true);

                // Signature.Image = new UIImage();
                Signature.Clear();
                hasBeenSigned = false;
                SigningMode   = true;

                this.NavigationController.SetNavigationBarHidden(false, true);
                this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem("Clear Signature", UIBarButtonItemStyle.Bordered, ClearSignature), true);
                this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning), true);
                this.NavigationController.SetToolbarHidden(true, true);
                //				this.NavigationItem.SetRightBarButtonItems (new UIBarButtonItem[] {
                //					new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning),
                //					new UIBarButtonItem("Clear Signature", UIBarButtonItemStyle.Bordered, ClearSignature) }, true);
            };

            FinishSigning = delegate {
                SigningMode = false;
                signing     = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Bordered, StartSigning);

                this.SetToolbarItems(new UIBarButtonItem[] {
                    back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    forward
                }, true);

                this.NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { }, true);
                this.NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] { }, true);
                this.NavigationController.SetToolbarHidden(false, true);

                UIImageView iv = new UIImageView();
                iv             = (UIImageView)Tabs._jobService.GeneratedPDFView.ViewWithTag(MyConstants.ServiceCallPDFTemplateTags.Signature);
                iv.ContentMode = UIViewContentMode.ScaleAspectFit;
                UIImage im = this.Signature.GetDrawingImage();                  // this.Signature.Image;
                iv.Image = im;

                if (hasBeenSigned)
                {
                    Tabs._jobService.RedrawServiceCallPDF(true);

                    CGPoint offset = new CGPoint(0, this.PDFView.ScrollView.ContentSize.Height - this.PDFView.ScrollView.Bounds.Height);
                    PDFView.ScrollView.SetContentOffset(offset, true);
                    // Signature.Image = new UIImage();
                    Signature.Clear();
                }

                iv.Dispose();  im.Dispose();
                im = null; iv = null;
            };

            back           = new UIBarButtonItem(UIBarButtonSystemItem.Reply);
            signing        = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Bordered, StartSigning);
            forward        = new UIBarButtonItem(UIBarButtonSystemItem.Action);
            clearSignature = new UIBarButtonItem("Clear signature", UIBarButtonItemStyle.Bordered, ClearSignature);

            ToolbarItems = new UIBarButtonItem[] {
                back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                forward
            };

            back.Clicked    += GoBack;
            forward.Clicked += GoForward;
        }
コード例 #19
0
        public SignPrePlumbingViewController(DetailedTabs tabs) : base(tabs)
        {
            this.Title = "Sign pre-plumbing";
            using (var image = UIImage.FromBundle("Images/187-pencil")) this.TabBarItem.Image = image;
            this.NavigationItem.HidesBackButton = true;

            GoBack = delegate {
                if (!SigningMode)
                {
                    Tabs.SelectedViewController = Tabs.ViewControllers[Tabs.LastSelectedTab];
                }
                else
                {
                    FinishSigning(null, null);
                    hasBeenSigned = false;
                    Tabs.SelectedViewController = Tabs.ViewControllers[Tabs.LastSelectedTab];
                }
            };

            GoForward = delegate {
                if (hasBeenSigned && !SigningMode)
                {
                    bool ShouldSignService = false;
                    Job  main = (Tabs._jobRunTable.CurrentJob.HasParent())?  Tabs._jobRunTable.FindParentJob(Tabs._jobRunTable.CurrentJob) : Tabs._jobRunTable.CurrentJob;
                    if (main.Type.Code == "SER")
                    {
                        ShouldSignService = true;
                    }
                    foreach (Job child in main.ChildJobs)
                    {
                        if (child.Type.Code == "SER")
                        {
                            ShouldSignService = true;
                        }
                    }


                    if ((Tabs._prePlumbView.pr.UpgradeOffered == PrePlumbingCheckView.Choices.Option1 ||
                         Tabs._prePlumbView.pr.UpgradeOffered == PrePlumbingCheckView.Choices.Option2) &&
                        Tabs._prePlumbView.pr.CustomerAcceptedUpgrade == PrePlumbingCheckView.Choices.Yes)
                    {
                        // look for a tubing upgrade job
                        bool foundUpgrade = false;
                        if (main.Type.Code.Contains("TUBING"))
                        {
                            foundUpgrade = true;
                        }
                        if (!foundUpgrade)
                        {
                            foreach (Job child in main.ChildJobs)
                            {
                                if (child.Type.Code.Contains("TUBING"))
                                {
                                    foundUpgrade = true;
                                }
                            }
                        }
                        if (!foundUpgrade)
                        {
                            Dictionary <int, string> Reasons = MyConstants.GetFollowUpReasonsFromDB();
                            string pickedReason = "Unable to do upgrade";
                            int    reasonID     = Reasons.FindKeyByValue(pickedReason);
                            Tabs._jobService.SaveFollowupToDatabase(main.JobBookingNumber, reasonID, "Upgrade was authorised and not done?");
                        }
                    }

                    if (ShouldSignService)
                    {
                        Tabs.SigningNav.PopToRootViewController(false);
                        Tabs.SigningNav.PushViewController(Tabs.SignService, true);
                    }
                    else
                    {
                        Tabs.SigningNav.PushViewController(Tabs.SignInvoice, true);
                        //Tabs.SigningNav.InvoicePushed = true;
                        // Tabs._navWorkflow._finishWorkflow(null, null);
                    }
                }
                else
                {
                    var alert = new UIAlertView("", "Please finish signing the document first", null, "OK");
                    alert.Show();
                }
            };

            ClearSignature = delegate {
                // Signature.Image = new UIImage();
                Signature.Clear();
                hasBeenSigned = false;
            };

            StartSigning = delegate {
                signing = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning);
                this.SetToolbarItems(new UIBarButtonItem[] {
                    back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    clearSignature, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    forward
                }, true);

                // Signature.Image = new UIImage();
                Signature.Clear();
                hasBeenSigned = false;
                SigningMode   = true;

                this.NavigationController.SetNavigationBarHidden(false, true);
                this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem("Clear Signature", UIBarButtonItemStyle.Bordered, ClearSignature), true);
                this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning), true);

//				this.NavigationItem.SetRightBarButtonItems (new UIBarButtonItem[] {
//					new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, FinishSigning),
//					new UIBarButtonItem("Clear Signature", UIBarButtonItemStyle.Bordered, ClearSignature) }, true);

                this.NavigationController.SetToolbarHidden(true, true);
            };

            FinishSigning = delegate {
                SigningMode = false;
                signing     = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Bordered, StartSigning);

                this.SetToolbarItems(new UIBarButtonItem[] {
                    back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                    forward
                }, true);

                this.NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { }, true);
                this.NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] { }, true);
                this.NavigationController.SetToolbarHidden(false, true);

                UIImageView iv = new UIImageView();
                iv = (UIImageView)Tabs._prePlumbView.GeneratedPDFView.ViewWithTag(MyConstants.PrePlumbingPDFTemplateTags.Signature);

                iv.ContentMode = UIViewContentMode.ScaleAspectFit;
                UIImage im = this.Signature.GetDrawingImage();                  // this.Signature.Image;
                iv.Image = im;

                if (hasBeenSigned)
                {
                    Tabs._prePlumbView.RedrawPrePlumbingPDF(false, true);

                    CGPoint offset = new CGPoint(0, this.PDFView.ScrollView.ContentSize.Height - this.PDFView.ScrollView.Bounds.Height);
                    PDFView.ScrollView.SetContentOffset(offset, true);
                    Signature.Clear();                      // Signature.Image = new UIImage();
                }

                iv.Dispose();  im.Dispose();
                im = null; iv = null;
            };

            back           = new UIBarButtonItem(UIBarButtonSystemItem.Reply);
            signing        = new UIBarButtonItem("Start signing", UIBarButtonItemStyle.Bordered, StartSigning);
            forward        = new UIBarButtonItem(UIBarButtonSystemItem.Action);
            clearSignature = new UIBarButtonItem("Clear signature", UIBarButtonItemStyle.Bordered, ClearSignature);

            ToolbarItems = new UIBarButtonItem[] {
                back, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                signing, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                forward
            };

            back.Clicked    += GoBack;
            forward.Clicked += GoForward;
        }
コード例 #20
0
 public ServiceNavigationController(DetailedTabs tabs)
 {
     Tabs = tabs;
 }
コード例 #21
0
 public ServerClientViewController(DetailedTabs tabs) : base("ServerClient", null)
 {
     this.Title = NSBundle.MainBundle.LocalizedString("Server/Client", "Server/Client");
     using (var image = UIImage.FromBundle("Images/174-imac")) this.TabBarItem.Image = image;
     this._tabs = tabs;
 }
コード例 #22
0
 public TakePhotosViewController(DetailedTabs tabs) : base("TakePhotosViewController", null)
 {
     this._tabs = tabs;
     this.Title = NSBundle.MainBundle.LocalizedString("Take photos", "Take photos");
     using (var image = UIImage.FromBundle("Images/86-camera")) this.TabBarItem.Image = image;
 }
コード例 #23
0
 public ServerClientNavigatonController(DetailedTabs tabs) : base()
 {
     Tabs = tabs;
     NavigationBarHidden = true;
 }