예제 #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="PmChannelModel" /> class.
        ///     Creates a new Channel data model which will always be a Pm
        /// </summary>
        /// <param name="character">
        ///     The character that sent the message
        /// </param>
        public PmChannelModel(ICharacter character)
            : base(character.Name, ChannelType.PrivateMessage)
        {
            TargetCharacter = character;
            TargetCharacter.GetAvatar();

            updateTick     = new Timer(1000);
            isTypingString = new StringBuilder();
            Settings       = new ChannelSettingsModel(true);

            updateTick.Elapsed += (s, e) =>
            {
                if (isTypingString.Length < 3)
                {
                    isTypingString.Append(".");
                }
                else
                {
                    isTypingString.Clear();
                    isTypingString.Append(".");
                }

                OnPropertyChanged("TypingString");
            };
        }
예제 #2
0
        protected override void Dispose(bool isManaged)
        {
            if (isManaged)
            {
                Messages.Clear();
                Ads.Clear();
                settings = new ChannelSettingsModel();
            }

            base.Dispose(isManaged);
        }
예제 #3
0
        protected override void Dispose(bool isManaged)
        {
            if (isManaged)
            {
                updateTick.Dispose();
                updateTick     = null;
                isTypingString = null;
                Settings       = new ChannelSettingsModel(true);
            }

            base.Dispose(isManaged);
        }
예제 #4
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(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);
            }
        }
예제 #5
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);
            }
        }
예제 #6
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);
            }
        }
예제 #7
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="PmChannelModel" /> class.
        ///     Creates a new Channel data model which will always be a Pm
        /// </summary>
        /// <param name="character">
        ///     The character that sent the message
        /// </param>
        public PmChannelModel(ICharacter character)
            : base(character.Name, ChannelType.PrivateMessage)
        {
            TargetCharacter = character;
            TargetCharacter.GetAvatar();

            updateTick = new Timer(1000);
            isTypingString = new StringBuilder();
            Settings = new ChannelSettingsModel(true);

            updateTick.Elapsed += (s, e) =>
                {
                    if (isTypingString.Length < 3)
                        isTypingString.Append(".");
                    else
                    {
                        isTypingString.Clear();
                        isTypingString.Append(".");
                    }

                    OnPropertyChanged("TypingString");
                };
        }
예제 #8
0
        /// <summary>
        ///     The dispose.
        /// </summary>
        /// <param name="isManaged">
        ///     The is managed.
        /// </param>
        protected override void Dispose(bool isManaged)
        {
            if (isManaged)
            {
                updateTick.Dispose();
                updateTick = null;
                isTypingString = null;
                Settings = new ChannelSettingsModel(true);
            }

            base.Dispose(isManaged);
        }
예제 #9
0
 protected override void Dispose(bool isManaged)
 {
     Settings = new ChannelSettingsModel();
     base.Dispose(isManaged);
 }
예제 #10
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);
            }
        }
예제 #11
0
        protected override void Dispose(bool isManaged)
        {
            if (isManaged)
            {
                messages.Clear();
                ads.Clear();
                settings = new ChannelSettingsModel();
            }

            base.Dispose(isManaged);
        }
예제 #12
0
 protected override void Dispose(bool isManaged)
 {
     Settings = new ChannelSettingsModel();
     base.Dispose(isManaged);
 }