コード例 #1
0
            private void OnTouchUpInside(object sender, EventArgs eventArgs)
            {
                UITextField textField;
                var         superview = GetTextFieldSuperview(out textField);

                if (superview == null)
                {
                    Tracer.Warn("Cannot get superview for " + textField);
                    return;
                }

                if (_popup == null)
                {
                    var showOnRect = textField.ConvertRectToView(Frame, superview);
                    var fieldFrame = superview.ConvertRectToView(textField.Frame, superview);
                    _popup = _errorProvider.CreateValidationPopup(showOnRect, fieldFrame);
                    _popup.TranslatesAutoresizingMaskIntoConstraints = false;
                    _popup.Message = _message;

                    _message = null;
                }
                if (_popup.Superview == null)
                {
                    superview.AddSubview(_popup);

                    var dict = new NSDictionary("popup", _popup);
                    _popup.Superview?.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"H:|-0-[popup]-0-|",
                                                                                         NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict));
                    _popup.Superview?.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"V:|-0-[popup]-0-|",
                                                                                         NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict));
                }
            }
コード例 #2
0
 private void HidePopup()
 {
     if (_popup == null)
     {
         return;
     }
     _popup.RemoveFromSuperview();
     _popup.Dispose();
     _popup = null;
 }
コード例 #3
0
 private void HidePopup()
 {
     if (_popup == null)
     {
         return;
     }
     _popup.RemoveFromSuperview();
     _popup.ClearBindingsRecursively(true, true);
     _popup.DisposeEx();
     _popup = null;
 }
コード例 #4
0
        public bool Save(Action<bool> saved)
        {
            var validationErrors = GetErrors();
            if (validationErrors.Any())
            {
                View.ValidationPopup.Show(validationErrors);
                return false;
            }
            View.PipeControl.saveButton.IsEnabled = false;

            AddPipeRevisionHistoryDialog pipeRevisionHistoryDialog = new AddPipeRevisionHistoryDialog(mPipe.Id, mPipe.Name);
            pipeRevisionHistoryDialog.Show();

            pipeRevisionHistoryDialog.Closed +=
                (s, e) =>
                {
                    if (pipeRevisionHistoryDialog.DialogResult.HasValue && pipeRevisionHistoryDialog.DialogResult.Value)
                    {
                        CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
                        PipeComponentsControl componentsControl = View.ComponentsTab.Content as PipeComponentsControl;
                        //SAVE COMP
                        cmsWebServiceClient.MovePipeComponentCompleted += (s2, e2) =>
                        {
                            if (e2.Result.HasErrors)
                            {
                                //val popup..
                                ValidationPopup vp = new ValidationPopup();
                                vp.Show(Utils.BuildValidationResultFromServerErrors("Move Component Failed", e2.Result.ServerErrorMessages));
                            }
                            else
                            {

                                BuildMoveComponentRevisionHistory(componentsControl);
                                //save actual equipment 2nd
                                SavePipe(saved, cmsWebServiceClient);
                            }
                        };

                        //save any component moves 1st
                        cmsWebServiceClient.MovePipeComponentAsync(componentsControl.Model.MovedComponent);
                    }

                    View.PipeControl.saveButton.IsEnabled = true;
                };
            return false;
        }
コード例 #5
0
 private void HidePopup()
 {
     if (_popup == null)
         return;
     _popup.RemoveFromSuperview();
     _popup.ClearBindingsRecursively(true, true);
     _popup.DisposeEx();
     _popup = null;
 }
コード例 #6
0
            private void OnTouchUpInside(object sender, EventArgs eventArgs)
            {
                UITextField textField;
                var superview = GetTextFieldSuperview(out textField);
                if (superview == null)
                {
                    Tracer.Warn("Cannot get superview for " + textField);
                    return;
                }

                if (_popup == null)
                {
                    var showOnRect = textField.ConvertRectToView(Frame, superview);
                    var fieldFrame = superview.ConvertRectToView(textField.Frame, superview);
                    _popup = _errorProvider.CreateValidationPopup(showOnRect, fieldFrame);
                    _popup.TranslatesAutoresizingMaskIntoConstraints = false;
                    _popup.Message = _message;

                    _message = null;
                }
                if (_popup.Superview == null)
                {
                    superview.AddSubview(_popup);

                    var dict = new NSDictionary("popup", _popup);
                    _popup.Superview.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"H:|-0-[popup]-0-|",
                            NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict));
                    _popup.Superview.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"V:|-0-[popup]-0-|",
                        NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict));
                }
            }
コード例 #7
0
        private void SaveMechanicalEquipment(Action<bool> saved, CmsWebServiceClient cmsWebServiceClient)
        {
            cmsWebServiceClient.SaveMechanicalEquipmentCompleted +=
                (s, e) =>
                {
                    if (e.Result.HasErrors)
                    {
                        //val popup..
                        ValidationPopup vp = new ValidationPopup();
                        vp.Show(Utils.BuildValidationResultFromServerErrors("Save Failed", e.Result.ServerErrorMessages));
                        return;
                    }

                    EventAggregator.GetEvent<PrismEvents.RefreshNavigationEvent>().Publish(new QuickMechanical());

                    QuickMechanical quickMechanical = e.Result.EntityResult;

                    mMechanicalAttachmentsControl.ViewModel.RaisePropertyChanged("Attachments");

                    //Reset controls to Original Values
                    Utils.ResetOriginalValues(EquipmentControl.LayoutGrid);
                    Utils.ResetOriginalValues(mMechanicalAttachmentsControl.Content);
                    Utils.ResetOriginalValues(mComponentsControl.Content);
                    Utils.ResetOriginalValues(mMechanicalRelatedIssuesControl.Content);
                    Utils.ResetOriginalValues((UserControl)AttachmentsTab.Content);

                    //Clear all changes on the Tab
                    Utils.ClearAllChangeEvents(EventAggregator, ViewModel.Equipment);

                    if (saved != null)
                    {
                        saved(true);
                    }

                    RevisionHistory.LoadRevisionHistory(CommonUtils.TabId.Mechanical, mEquipmentId);

                    var releoadFinished = new Action(() =>
                    {
                        mComponentsControl.Model.Equipment = ViewModel.Equipment;
                        mComponentsControl.Model.RaisePropertyChanged("Components");
                    });

                    //Reload the Components
                    //This will make sure that all componentes have Ids assigned after save
                    ViewModel.ReloadInstrument(releoadFinished, ViewModel.Equipment.Id);
                };

            cmsWebServiceClient.SaveMechanicalEquipmentAsync(ViewModel.Equipment, CMS.User.Id);
        }