Beispiel #1
0
        public override void ViewDidLoad()
        {
            try {
                TitleLabel.Font = Theme.HugeFont;
                TitleLabel.Text = "EMAIL";

                _info = Repo.Foreground.Table <ShareInfo> ().FirstOrDefault();
                if (_info == null)
                {
                    _info = new ShareInfo {
                        From = UIDevice.CurrentDevice.Name, To = ""
                    };
                    Repo.Foreground.Insert(_info);
                }

                var y = TitleLabel.Frame.Bottom + App.Inst.LabelGap;
                _form = new Form(_info, new RectangleF(TitleLabel.Frame.Left, y, View.Frame.Width, View.Frame.Height - y));
                _form.ConfirmButtonText = "SHARE";
                _form.ShowCancelButton  = true;

                _form.OnCancel += delegate {
                    try {
                        App.Inst.PopDialog();
                    } catch (Exception error) {
                        Log.Error(error);
                    }
                };
                _form.OnOK += delegate {
                    try {
                        Repo.Foreground.Update(_info);

                        var sh = new ShareMessage {
                            From = _info.From, To = _info.To, Comment = "", MessageId = Message.Id, Status = ShareMessageStatus.Unsent
                        };
                        Repo.Foreground.Insert(sh);

                        ShareUpdater.SetSharesChanged();

                        App.Inst.PopDialog();
                    } catch (Exception error) {
                        Log.Error(error);
                    }
                };

                View.AddSubview(_form);
            } catch (Exception error) {
                Log.Error(error);
            }
        }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            try {
                TitleLabel.Font = Theme.HugeFont;
                TitleLabel.Text = "EMAIL";

                _info = Repo.Foreground.Table<ShareInfo> ().FirstOrDefault ();
                if (_info == null) {
                    _info = new ShareInfo { From = UIDevice.CurrentDevice.Name, To = "" };
                    Repo.Foreground.Insert (_info);
                }

                var y = TitleLabel.Frame.Bottom + App.Inst.LabelGap;
                _form = new Form (_info, new RectangleF (TitleLabel.Frame.Left, y, View.Frame.Width, View.Frame.Height - y));
                _form.ConfirmButtonText = "SHARE";
                _form.ShowCancelButton = true;

                _form.OnCancel += delegate {
                    try {
                        App.Inst.PopDialog ();
                    } catch (Exception error) {
                        Log.Error (error);
                    }
                };
                _form.OnOK += delegate {
                    try {
                        Repo.Foreground.Update (_info);

                        var sh = new ShareMessage { From = _info.From, To = _info.To, Comment = "", MessageId = Message.Id, Status = ShareMessageStatus.Unsent };
                        Repo.Foreground.Insert (sh);

                        ShareUpdater.SetSharesChanged ();

                        App.Inst.PopDialog ();

                    } catch (Exception error) {
                        Log.Error (error);
                    }
                };

                View.AddSubview (_form);
            } catch (Exception error) {
                Log.Error (error);
            }
        }