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

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

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

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

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

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

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

            if (TaskShortLable != null)
            {
                TaskShortLable.Dispose();
                TaskShortLable = null;
            }
        }
예제 #2
0
        //public override void ViewDidLoad()
        //{
        //    base.ViewDidLoad();

        //    var CattegoryList = new List<String>
        //    {
        //        "None", "Home", "Work", "Learning", "Fun"
        //    };

        //    var cattegoryViewModel = new CattegoryViewModel(CattegoryList);

        //    CattegoryPicker.Model = cattegoryViewModel;

        //    cattegoryViewModel.CattegoryChange += (sender, e) =>
        //    {
        //        Cattegory = cattegoryViewModel.SelectedCattegory;
        //    };
        //} ctrl e c

        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            DatePicker.Locale   = NSLocale.CurrentLocale;
            DatePicker.TimeZone = NSTimeZone.LocalTimeZone;

            TaskShortLable.Layer.BorderColor  = UIColor.LightGray.CGColor;
            TaskShortLable.Layer.CornerRadius = 5.0f;
            TaskShortLable.Layer.BorderWidth  = 0.25f;


            var CattegoryList = new List <String>
            {
                "None", "Meeting", "Activit", "Learning", "Home", "Other"
            };
            var cattegoryViewModel = new CattegoryViewModel(CattegoryList);

            CattegoryPicker.Model = cattegoryViewModel;

            cattegoryViewModel.CattegoryChange += (sender, e) =>
            {
                Cattegory = cattegoryViewModel.SelectedCattegory;
                Console.WriteLine(Cattegory);
                if (Cattegory == "Other")
                {
                    var AlertInput = new UIAlertView();
                    AlertInput.Title = "Own cattegory";
                    AlertInput.AddButton("OK");
                    AlertInput.Message        = "Please enter your cattegory";
                    AlertInput.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
                    AlertInput.Clicked       += (object s, UIButtonEventArgs ev) =>
                    {
                        if (ev.ButtonIndex == 0)
                        {
                            Cattegory = AlertInput.GetTextField(0).Text;
                        }
                    };
                    AlertInput.Show();
                }
            };

            if (EditingEnable)
            {
                TaskName.Text         = currentTask.Name;
                TaskShortLable.Text   = currentTask.ShortLabel;
                NotificationSwitch.On = currentTask.Notification;
                CalendarSwitch.On     = currentTask.CalenderEvent;
                Duration.Text         = currentTask.Duration.ToString();
                if (CattegoryList.Contains(currentTask.Cattegory))
                {
                    CattegoryPicker.Select(CattegoryList.IndexOf(currentTask.Cattegory), 0, true);
                }
                else
                {
                    CattegoryPicker.Select(CattegoryList.Count - 1, 0, true);
                    Cattegory = currentTask.Cattegory;
                }

                DatePicker.Date = currentTask.DateAndTime;
            }
        }