Ejemplo n.º 1
0
        void OnEditOptionsChanged(PollOptionEditor option, string property)
        {
            switch (property)
            {
            case "Key":
                if (string.IsNullOrEmpty(option.OldKey))
                {
                    option.Poll = selectedpoll;
                    context.GetModule <PollModule>().CreatePollOption(option.Poll, option.Key, option.Description);
                }
                else
                {
                    context.GetModule <PollModule>().ChangePollOption(option.Poll, option.OldKey, option.Key, option.Description);
                }
                votes.Where(v => v.Vote == option.OldKey).ToArray().Foreach(v => v.Vote = option.Key);
                break;

            case "Locked":
                context.GetModule <PollModule>().LockOption(option.Poll, option.Key, option.Locked);
                break;

            default:
                context.GetModule <PollModule>().ChangePollOption(option.Poll, option.OldKey, option.Key, option.Description);
                break;
            }
            option.Apply();
        }
Ejemplo n.º 2
0
        void Context_RemoveOption(object sender, RoutedEventArgs e)
        {
            PollOptionEditor option = grdPollOptions.SelectedItem as PollOptionEditor;

            if (option == null)
            {
                return;
            }

            context.GetModule <PollModule>().RemovePollOption(option.Poll, option.Key);
        }
Ejemplo n.º 3
0
        void grdPollOptions_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            PollOptionEditor item = grdPollOptions.SelectedItem as PollOptionEditor;

            ctxRemoveOption.IsEnabled = item != null;
        }