void ReleaseDesignerOutlets() { if (CancelButton != null) { CancelButton.Dispose(); CancelButton = null; } if (DoneSwitch != null) { DoneSwitch.Dispose(); DoneSwitch = null; } if (ForText != null) { ForText.Dispose(); ForText = null; } if (NameText != null) { NameText.Dispose(); NameText = null; } if (NotesText != null) { NotesText.Dispose(); NotesText = null; } if (SaveButton != null) { SaveButton.Dispose(); SaveButton = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); NavigationItem.LargeTitleDisplayMode = UINavigationItemLargeTitleDisplayMode.Never; SaveButton.TouchUpInside += (sender, e) => { current.Name = NameText.Text; current.Notes = NotesText.Text; current.Done = DoneSwitch.On; current.For = ForText.Text; // includes CoreSpotlight indexing! Delegate.SaveTodo(current); UIAccessibility.PostNotification(UIAccessibilityPostNotification.Announcement, new NSString(@"Item was saved")); NavigationController.PopViewController(true); }; CancelButton.TouchUpInside += (sender, e) => { if (Delegate != null) { Delegate.DeleteTodo(current); // also CoreSpotlight UIAccessibility.PostNotification(UIAccessibilityPostNotification.Announcement, new NSString(@"Item was deleted")); } else // HACK: TODO: { Console.WriteLine("Delegate not set - HACK"); } NavigationController.PopViewController(true); }; #region iOS 9 Contacts contacts = new ContactHelper(current); UITapGestureRecognizer forTextTap = new UITapGestureRecognizer(() => { PresentViewController(contacts.GetPicker(), true, null); }); ForText.AddGestureRecognizer(forTextTap); ForText.UserInteractionEnabled = true; #endregion NameText.TextAlignment = UITextAlignment.Natural; NotesText.TextAlignment = UITextAlignment.Natural; UserActivity = UserActivityHelper.CreateNSUserActivity(current ?? new TodoItem()); }
protected override void OnPaint(PaintEventArgs e) { try { if (m_bIsComboBox) { Row CurSel = m_RowWnd.CurrSel; bool bHaveRow = m_RowWnd.CurrSel != null; SolidBrush Backcolor; if (m_AllowRowColorCombo && bHaveRow) { Backcolor = new SolidBrush(m_RowWnd.GetRowColor(ColorSelection.BackColor, m_RowWnd.CurrSel)); } else { Backcolor = new SolidBrush(m_RowWnd.BackColor); } e.Graphics.FillRectangle(Backcolor, this.ClientRectangle); Backcolor.Dispose(); Rectangle BtnRect = GetButtonRect(); if (UxThemeManager.VisualStylesEnabled()) { IntPtr hDC = e.Graphics.GetHdc(); m_ThemeManager[this].DrawThemeBackground(UxThemeElements.COMBOBOX, hDC, (int)ComboBoxPart.DropDownButtonRight, GetComboButtonState(), ref BtnRect, IntPtr.Zero); e.Graphics.ReleaseHdc(hDC); } int nWidth = this.ClientRectangle.Width - BtnRect.Width - 2; if (nWidth > 0) { int nHeight = this.ClientRectangle.Height - 2; if (nHeight > 0) { bool bNeedSelColor = (IsDroppedDown || ContainsFocus) && !ReadOnly; if (bNeedSelColor) { SolidBrush SelBackcolor; if (m_AllowRowColorCombo && bHaveRow) { SelBackcolor = new SolidBrush(m_RowWnd.GetRowColor(ColorSelection.SelBackColor, CurSel)); } else { SelBackcolor = new SolidBrush(SystemColors.Highlight); } e.Graphics.FillRectangle(SelBackcolor, 1, 1, nWidth, nHeight); SelBackcolor.Dispose(); Pen p = new Pen(Color.DarkGray); p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; e.Graphics.DrawRectangle(p, 1, 1, nWidth, nHeight); p.Dispose(); } nWidth -= 4; nHeight -= 8; if (nWidth > 0 && nHeight > 0) { StringFormat sf = new StringFormat(); sf.FormatFlags = System.Drawing.StringFormatFlags.NoWrap; sf.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; Brush ForText; if (bHaveRow) { ForText = new SolidBrush(m_RowWnd.GetRowColor(bNeedSelColor ? ColorSelection.SelForeColor : ColorSelection.ForeColor, CurSel)); } else { ForText = new SolidBrush(bNeedSelColor ? SystemColors.HighlightText : this.ForeColor); } e.Graphics.DrawString(bHaveRow ? CurSel.ToString(m_strComboFormat) : m_strComboText, this.Font, ForText, new Rectangle(5, 5, nWidth, nHeight), sf); ForText.Dispose(); sf.Dispose(); } } } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } base.OnPaint(e); }