public GeneralChannelModel(
            string channelName, ChannelType type, int users = 0, ChannelMode mode = ChannelMode.Both)
            : base(channelName, type, mode)
        {
            try
            {
                if (users < 0)
                {
                    throw new ArgumentOutOfRangeException(nameof(users), "Users cannot be a negative number");
                }

                UserCount = users;

                CharacterManager = new ChannelCharacterManager();
                Settings         = new ChannelSettingsModel();

                // the message count now faces the user, so when we reset it it now requires a UI update
                Messages.CollectionChanged += (s, e) =>
                {
                    if (e.Action != NotifyCollectionChangedAction.Reset)
                    {
                        return;
                    }

                    LastReadCount = Messages.Count;
                    UpdateBindings();
                };

                Ads.CollectionChanged += (s, e) =>
                {
                    if (e.Action != NotifyCollectionChangedAction.Reset)
                    {
                        return;
                    }

                    LastReadAdCount = Ads.Count;
                    UpdateBindings();
                };
            }
            catch (Exception ex)
            {
                ex.Source = "General Channel Model, init";
                Exceptions.HandleException(ex);
            }
        }
        public GeneralChannelModel(string name, string title, ChannelType type)
            : base(name, type, ChannelMode.Both)
        {
            try
            {
                UserCount = 0;

                CharacterManager = new ChannelCharacterManager();
                Settings         = new ChannelSettingsModel();
                Title            = title;

                // the message count now faces the user, so when we reset it it now requires a UI update
                Messages.CollectionChanged += (s, e) =>
                {
                    if (e.Action != NotifyCollectionChangedAction.Reset)
                    {
                        return;
                    }

                    LastReadCount = Messages.Count;
                    UpdateBindings();
                };

                Ads.CollectionChanged += (s, e) =>
                {
                    if (e.Action != NotifyCollectionChangedAction.Reset)
                    {
                        return;
                    }

                    LastReadAdCount = Ads.Count;
                    UpdateBindings();
                };
            }
            catch (Exception ex)
            {
                ex.Source = "General Channel Model, init";
                Exceptions.HandleException(ex);
            }
        }
Example #3
0
        public GeneralChannelModel(
            string channelName, ChannelType type, int users = 0, ChannelMode mode = ChannelMode.Both)
            : base(channelName, type, mode)
        {
            try
            {
                if (users < 0)
                    throw new ArgumentOutOfRangeException("users", "Users cannot be a negative number");

                UserCount = users;

                CharacterManager = new ChannelCharacterManager();
                Settings = new ChannelSettingsModel();

                // the message count now faces the user, so when we reset it it now requires a UI update
                Messages.CollectionChanged += (s, e) =>
                    {
                        if (e.Action != NotifyCollectionChangedAction.Reset)
                            return;

                        LastReadCount = Messages.Count;
                        UpdateBindings();
                    };

                Ads.CollectionChanged += (s, e) =>
                    {
                        if (e.Action != NotifyCollectionChangedAction.Reset)
                            return;

                        LastReadAdCount = Ads.Count;
                        UpdateBindings();
                    };
            }
            catch (Exception ex)
            {
                ex.Source = "General Channel Model, init";
                Exceptions.HandleException(ex);
            }
        }
Example #4
0
        public GeneralChannelModel(string name, string title, ChannelType type)
            : base(name, type, ChannelMode.Both)
        {
            try
            {
                UserCount = 0;

                CharacterManager = new ChannelCharacterManager();
                Settings = new ChannelSettingsModel();
                Title = title;

                // the message count now faces the user, so when we reset it it now requires a UI update
                Messages.CollectionChanged += (s, e) =>
                {
                    if (e.Action != NotifyCollectionChangedAction.Reset)
                        return;

                    LastReadCount = Messages.Count;
                    UpdateBindings();
                };

                Ads.CollectionChanged += (s, e) =>
                {
                    if (e.Action != NotifyCollectionChangedAction.Reset)
                        return;

                    LastReadAdCount = Ads.Count;
                    UpdateBindings();
                };
            }
            catch (Exception ex)
            {
                ex.Source = "General Channel Model, init";
                Exceptions.HandleException(ex);
            }
        }