private void EventTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.EventTypeComboBox.SelectedIndex >= 0)
     {
         ConstellationEventTypeEnum eventType = EnumHelper.GetEnumValueFromString <ConstellationEventTypeEnum>((string)this.EventTypeComboBox.SelectedItem);
     }
 }
示例#2
0
        public BasicEventCommandEditorControl(CommandWindow window, ConstellationEventTypeEnum eventType, BasicCommandTypeEnum commandType)
        {
            this.window      = window;
            this.eventType   = eventType;
            this.commandType = commandType;

            InitializeComponent();
        }
示例#3
0
        private EventCommandItem GetEventCommand(ConstellationEventTypeEnum eventType)
        {
            EventCommand command = ChannelSession.Settings.EventCommands.FirstOrDefault(c => c.EventType.Equals(eventType));

            if (command != null)
            {
                return(new EventCommandItem(command));
            }
            else
            {
                return(new EventCommandItem(eventType));
            }
        }
        public BasicEventCommandEditorControl(CommandWindow window, EventCommand command)
            : this(window, command.EventType, BasicCommandTypeEnum.None)
        {
            this.window  = window;
            this.command = command;
            if (this.command.IsOtherEventType)
            {
                this.otherEventType = this.command.OtherEventType;
            }
            else
            {
                this.eventType = this.command.EventType;
            }

            InitializeComponent();
        }
示例#5
0
 private void EventTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.EventTypeComboBox.SelectedIndex >= 0)
     {
         ConstellationEventTypeEnum eventType = EnumHelper.GetEnumValueFromString <ConstellationEventTypeEnum>((string)this.EventTypeComboBox.SelectedItem);
         if (eventType.ToString().Contains("id") && this.command == null)
         {
             this.EventIDTextBox.IsEnabled = true;
         }
         else
         {
             this.EventIDTextBox.IsEnabled = false;
             this.EventIDTextBox.Clear();
         }
     }
 }
 public ConstellationEventType(ConstellationEventTypeEnum type, uint id = 0)
 {
     this.Type = type;
     this.ID   = id;
 }
示例#7
0
 public EventCommand(ConstellationEventTypeEnum type, uint id, string name)
     : base(EnumHelper.GetEnumName(type), CommandTypeEnum.Event, name)
 {
     this.EventType = type;
     this.EventID   = id;
 }
示例#8
0
 public EventCommand(ConstellationEventTypeEnum type, UserModel user) : this(type, user.id, user.username)
 {
 }
示例#9
0
 public EventCommand(ConstellationEventTypeEnum type, ChannelAdvancedModel channel) : this(type, channel.id, channel.user.username)
 {
 }
示例#10
0
 public EventCommand(ConstellationEventTypeEnum type) : this(type, 0, string.Empty)
 {
 }
示例#11
0
 public EventCommandItem(ConstellationEventTypeEnum eventType)
 {
     this.EventType = eventType;
 }
示例#12
0
 public EventCommand(ConstellationEventTypeEnum type, UserModel user) : this(type, user.id, user.id.ToString())
 {
 }
示例#13
0
 public void Initialize(MainControlBase control, ConstellationEventTypeEnum eventType)
 {
     this.mainControl = control;
     this.eventType   = eventType;
     this.RefreshControl();
 }
        public EventCommandDetailsControl(ConstellationEventTypeEnum eventType)
        {
            this.EventType = eventType;

            InitializeComponent();
        }
        public override async Task <CommandBase> GetNewCommand()
        {
            if (await this.Validate())
            {
                if (this.command == null)
                {
                    if (this.OtherEventTypeTextBox.Visibility == Visibility.Visible)
                    {
                        this.command = new EventCommand(EnumHelper.GetEnumValueFromString <OtherEventTypeEnum>(this.OtherEventTypeTextBox.Text), ChannelSession.Channel.id.ToString());
                    }
                    else if (this.EventTypeComboBox.Visibility == Visibility.Visible)
                    {
                        ConstellationEventTypeEnum eventType = EnumHelper.GetEnumValueFromString <ConstellationEventTypeEnum>((string)this.EventTypeComboBox.SelectedItem);

                        ChannelAdvancedModel channel = null;
                        UserModel            user    = null;

                        if (eventType.ToString().Contains("channel") || eventType.ToString().Contains("progression"))
                        {
                            channel = await ChannelSession.Connection.GetChannel(uint.Parse(this.EventIDTextBox.Text));

                            if (channel == null)
                            {
                                await MessageBoxHelper.ShowMessageDialog("Unable to find the channel for the specified username");

                                return(null);
                            }
                        }
                        else if (eventType.ToString().Contains("user"))
                        {
                            user = await ChannelSession.Connection.GetUser(uint.Parse(this.EventIDTextBox.Text));

                            if (user == null)
                            {
                                await MessageBoxHelper.ShowMessageDialog("Unable to find a user for the specified username");

                                return(null);
                            }
                        }

                        if (channel != null)
                        {
                            this.command = new EventCommand(eventType, channel);
                        }
                        else if (user != null)
                        {
                            this.command = new EventCommand(eventType, user);
                        }
                        else
                        {
                            this.command = new EventCommand(eventType);
                        }
                    }

                    if (ChannelSession.Settings.EventCommands.Any(se => se.UniqueEventID.Equals(this.command.UniqueEventID)))
                    {
                        await MessageBoxHelper.ShowMessageDialog("This event already exists");

                        return(null);
                    }

                    ChannelSession.Settings.EventCommands.Add(this.command);
                }
                this.command.Unlocked = this.UnlockedControl.Unlocked;
                return(this.command);
            }
            return(null);
        }