Ejemplo n.º 1
0
        void SaveButtonAction(object sender, EventArgs e)
        {
            try
            {
                loadingOverlay = new LoadingOverlay(contentView.Bounds);
                contentView.Add(loadingOverlay);

                UIImage im = AsImage(contentView);
                if (CrossConnectivity.Current.IsConnected)
                {
                    var bw = new BackgroundWorker();

                    // this allows our worker to report progress during work
                    bw.WorkerReportsProgress = true;

                    // what to do in the background thread
                    bw.DoWork += delegate(object o, DoWorkEventArgs argss)
                    {
                        var b = o as BackgroundWorker;

                        byte[] editArr  = im.AsJPEG(0.5f).ToArray();
                        var    saveType = MREditing ? "DynaPad Edit" : "DynaPad Note";

                        var dps = new DynaPadService.DynaPadService();
                        //byte[] saveArr = MREditType == "jpg" ? editArr : dps.ConvertToType(CommonFunctions.GetUserConfig(), editArr, MREditType);
                        byte[] saveArr  = editArr;
                        var    savefile = dps.SaveFile(CommonFunctions.GetUserConfig(), apptId, patientId, doctorId, locationId, filename, saveType, "DynaPad", "", "", saveArr, IsDoctorForm, false);
                    };

                    // what to do when worker completes its task (notify the user)
                    bw.RunWorkerCompleted += delegate
                    {
                        var savestring = MREditing ? "Edited File Saved" : "New Note Saved";
                        PresentViewController(CommonFunctions.AlertPrompt(savestring, "A new edit has been saved to medical records", true, null, false, null), true, null);
                    };

                    bw.RunWorkerAsync();

                    //byte[] editArr = im.AsJPEG(0.5f).ToArray();

                    //var dps = new DynaPadService.DynaPadService();
                    ////byte[] saveArr = MREditType == "jpg" ? editArr : dps.ConvertToType(CommonFunctions.GetUserConfig(), editArr, MREditType);
                    //byte[] saveArr = editArr;
                    //var savefile = dps.SaveFile(CommonFunctions.GetUserConfig(), apptId, patientId, doctorId, locationId, filename, "DynaPad Edit", "DynaPad", "", saveArr, IsDoctorForm, false);
                }
                else
                {
                    PresentViewController(CommonFunctions.InternetAlertPrompt(), true, null);
                }
            }
            catch (Exception ex)
            {
                CommonFunctions.sendErrorEmail(ex);
                PresentViewController(CommonFunctions.ExceptionAlertPrompt(), true, null);
            }
            finally
            {
                loadingOverlay.Hide();
            }
        }
Ejemplo n.º 2
0
        void SaveButtonAction(object sender, EventArgs e)
        {
            var ass  = cgView;
            var ass2 = cgView.StrokeCollection;
            var hole = strokeCollection;

            cgView.StrokeCollection = strokeCollection;
            UIImage im = AsImage(canvasContainerView);

            if (CrossConnectivity.Current.IsConnected)
            {
                //var bw = new BackgroundWorker();

                //// this allows our worker to report progress during work
                //bw.WorkerReportsProgress = true;

                //// what to do in the background thread
                //bw.DoWork += delegate (object o, DoWorkEventArgs argss)
                //{
                //	var b = o as BackgroundWorker;

                //	var dps = new DynaPadService.DynaPadService();
                //	var savefile = dps.SaveFile(CommonFunctions.GetUserConfig(), apptId, patientId, doctorId, locationId, filename, "DynaPad Photo", "DynaPad", "", im.AsJPEG(0.5f).ToArray(), IsDoctorForm, false);
                //};

                //// what to do when worker completes its task (notify the user)
                //bw.RunWorkerCompleted += delegate (object o, RunWorkerCompletedEventArgs argsss)
                //{
                //	PresentViewController(CommonFunctions.AlertPrompt("Edited File Saved", "A new edit has been saved to medical records", true, null, false, null), true, null);
                //};

                //bw.RunWorkerAsync();

                byte[] editArr = im.AsJPEG(0.5f).ToArray();

                var dps = new DynaPadService.DynaPadService();
                //byte[] saveArr = MREditType == "jpg" ? editArr : dps.ConvertToType(CommonFunctions.GetUserConfig(), editArr, MREditType);
                byte[] saveArr  = editArr;
                var    savefile = dps.SaveFile(CommonFunctions.GetUserConfig(), apptId, patientId, doctorId, locationId, filename, "DynaPad Edit", "DynaPad", "", "", saveArr, IsDoctorForm, false);
            }
            else
            {
                PresentViewController(CommonFunctions.InternetAlertPrompt(), true, null);
            }
        }