void ReleaseDesignerOutlets()
        {
            if (ConversationConsentContent != null)
            {
                ConversationConsentContent.Dispose();
                ConversationConsentContent = null;
            }

            if (ConversationConsentSubmit != null)
            {
                ConversationConsentSubmit.Dispose();
                ConversationConsentSubmit = null;
            }

            if (ConversationConsentTableView != null)
            {
                ConversationConsentTableView.Dispose();
                ConversationConsentTableView = null;
            }

            if (ConversationConsentTitle != null)
            {
                ConversationConsentTitle.Dispose();
                ConversationConsentTitle = null;
            }

            if (ConversationDecisionDes != null)
            {
                ConversationDecisionDes.Dispose();
                ConversationDecisionDes = null;
            }

            if (ConversationDecisionTitle != null)
            {
                ConversationDecisionTitle.Dispose();
                ConversationDecisionTitle = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ChooseLanguageTitle != null)
            {
                ChooseLanguageTitle.Dispose();
                ChooseLanguageTitle = null;
            }

            if (ConversationConsentSubmit != null)
            {
                ConversationConsentSubmit.Dispose();
                ConversationConsentSubmit = null;
            }

            if (ConversationConsentTableView != null)
            {
                ConversationConsentTableView.Dispose();
                ConversationConsentTableView = null;
            }

            if (ConversationDecisionDes != null)
            {
                ConversationDecisionDes.Dispose();
                ConversationDecisionDes = null;
            }

            if (LanguagePicker != null)
            {
                LanguagePicker.Dispose();
                LanguagePicker = null;
            }

            if (tableViewHeight != null)
            {
                tableViewHeight.Dispose();
                tableViewHeight = null;
            }
        }
Example #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = StringResources.consent_gabber_toolbar_title;

            int SelectedProjectID = Convert.ToInt32(NSUserDefaults.StandardUserDefaults.IntForKey("SelectedProjectID"));
            var SelectedProject   = Queries.ProjectById(SelectedProjectID);
            var content           = LanguageChoiceManager.ContentByLanguage(SelectedProject);

            ConversationDecisionDes.Text = string.Format(StringResources.consent_gabber_body_decision, Config.PRINT_URL);
            ChooseLanguageTitle.Text     = StringResources.conversation_language_prompt;

            List <User> participants   = Queries.SelectedParticipants().ToList();
            string      inConversation = StringResources.consent_gabber_consent_type_private_full_you;

            for (int i = 0; i < participants.Count; i++)
            {
                User p = participants[i];
                if (p.Id == Session.ActiveUser.Id)
                {
                    continue;
                }
                inConversation += ", " + p.Name;
            }

            int inProject = SelectedProject.Members.Count;

            var membersContent = string.Format(
                StringResources.consent_gabber_consent_type_members_full,
                inProject, (inProject > 1) ? StringResources.consent_gabber_consent_type_members_full_plural :
                StringResources.consent_gabber_consent_type_members_full_singular);

            var privateContent = string.Format(StringResources.consent_gabber_consent_type_private_full, inConversation);

            var items = new List <Consent>
            {
                new Consent {
                    Title    = StringResources.consent_gabber_consent_type_public_brief,
                    Subtitle = StringResources.consent_gabber_consent_type_public_full
                },
                new Consent {
                    Title    = string.Format(StringResources.consent_gabber_consent_type_members_brief, content.Title),
                    Subtitle = membersContent
                },
                new Consent {
                    Title    = StringResources.consent_gabber_consent_type_private_brief,
                    Subtitle = privateContent
                }
            };

            // Only show members if the project is private
            if (SelectedProject.IsPublic)
            {
                items.RemoveAt(1);
            }

            var consentVSource = new ConsentViewSource(items);

            consentVSource.ConsentSelected += (int selectedIndex) =>
            {
                var consentOptions = new string[] { "public", "members", "private" };
                ConsentType = consentOptions[selectedIndex];
                CheckSubmitEnabled();
            };

            ConversationConsentTableView.Source             = consentVSource;
            ConversationConsentTableView.RowHeight          = UITableView.AutomaticDimension;
            ConversationConsentTableView.EstimatedRowHeight = 86f;

            ConversationConsentSubmit.SetTitle(StringResources.consent_gabber_submit, UIControlState.Normal);
            ConversationConsentSubmit.Layer.BorderWidth = 1.0f;
            ConversationConsentSubmit.Layer.BorderColor = Application.MainColour;
            ConversationConsentSubmit.Enabled           = false;

            ConversationConsentSubmit.TouchUpInside += delegate
            {
                NSUserDefaults.StandardUserDefaults.SetString(ConsentType, "SESSION_CONSENT");
                NSUserDefaults.StandardUserDefaults.SetInt(pickerModel.GetChoice(LanguagePicker).Id, "SESSION_LANG");
            };

            LoadLanguages();
        }
Example #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = StringResources.consent_gabber_toolbar_title;

            int SelectedProjectID = Convert.ToInt32(NSUserDefaults.StandardUserDefaults.IntForKey("SelectedProjectID"));
            var SelectedProject   = Queries.ProjectById(SelectedProjectID);

            ConversationConsentTitle.Text             = StringResources.consent_gabber_title_control;
            ConversationConsentContent.AttributedText = ResearchConsent.BuildFromHTML(StringResources.consent_gabber_body_control);
            ConversationDecisionTitle.Text            = StringResources.consent_gabber_title_decision;
            ConversationDecisionDes.AttributedText    = ResearchConsent.BuildFromHTML(StringResources.consent_gabber_body_decision);

            var membersContent = string.Format(
                StringResources.consent_gabber_consent_type_members_full,
                SelectedProject.Members.Count,
                SelectedProject.Members.FindAll((obj) => obj.Role == "researcher").Count);

            var privateContent = string.Format(StringResources.consent_gabber_consent_type_private_full, BuildParticipants());

            var items = new List <Consent>
            {
                new Consent {
                    Title    = StringResources.consent_gabber_consent_type_public_brief,
                    Subtitle = ResearchConsent.BuildFromHTML(StringResources.consent_gabber_consent_type_public_full, 14, false)
                },
                new Consent {
                    Title    = StringResources.consent_gabber_consent_type_members_brief,
                    Subtitle = ResearchConsent.BuildFromHTML(membersContent, 14, false)
                },
                new Consent {
                    Title    = StringResources.consent_gabber_consent_type_private_brief,
                    Subtitle = ResearchConsent.BuildFromHTML(privateContent, 14, false)
                }
            };

            // Only show members if the project is private
            if (SelectedProject.IsPublic)
            {
                items.RemoveAt(1);
            }

            var consentVSource = new ConsentViewSource(items);

            consentVSource.ConsentSelected += (int selectedIndex) =>
            {
                var consentOptions = new string[] { "public", "members", "private" };
                ConsentType = consentOptions[selectedIndex];
                ConversationConsentSubmit.Enabled = true;
            };

            ConversationConsentTableView.Source             = consentVSource;
            ConversationConsentTableView.RowHeight          = UITableView.AutomaticDimension;
            ConversationConsentTableView.EstimatedRowHeight = 86f;

            ConversationConsentSubmit.SetTitle(StringResources.consent_gabber_submit, UIControlState.Normal);
            ConversationConsentSubmit.Layer.BorderWidth = 1.0f;
            ConversationConsentSubmit.Layer.BorderColor = UIColor.FromRGB(.43f, .80f, .79f).CGColor;
            ConversationConsentSubmit.Enabled           = false;

            ConversationConsentSubmit.TouchUpInside += delegate {
                NSUserDefaults.StandardUserDefaults.SetString(ConsentType, "SESSION_CONSENT");
            };
        }