Пример #1
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            string s = AlertsList.SelectedItem.ToString();

            ToggleEditing(true);

            var modifyAlert = new ModifyAlert(new Func <string, string, DateTime, bool>((string x, string y, DateTime dateTime)
                                                                                        => x == s || validFunc(x, y, dateTime)));

            Alert thisAlert = SelectedAlert;

            modifyAlert.SetValue(thisAlert.title, thisAlert.message, thisAlert.alertTime);

            SetNativeEnabled(false);

            modifyAlert.FormClosing += (se, ev) =>
            {
                SetNativeEnabled(true);

                if (modifyAlert.DialogResult == DialogResult.OK)
                {
                    Alert.EditToList(Alert.alerts.FindIndex(x => s == x.title), modifyAlert.GetValue());
                }

                ToggleEditing(false);
            };

            modifyAlert.Show();
        }
Пример #2
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            var modifyAlert = new ModifyAlert(validFunc);

            SetNativeEnabled(false);

            modifyAlert.FormClosing += (s, ev) =>
            {
                SetNativeEnabled(true);

                if (modifyAlert.DialogResult == DialogResult.OK)
                {
                    Alert.CreateAlert(modifyAlert.GetValue());
                }
            };

            modifyAlert.Show();
        }