/// <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"); }; }
protected override void Dispose(bool isManaged) { if (isManaged) { Messages.Clear(); Ads.Clear(); settings = new ChannelSettingsModel(); } base.Dispose(isManaged); }
protected override void Dispose(bool isManaged) { if (isManaged) { updateTick.Dispose(); updateTick = null; isTypingString = null; Settings = new ChannelSettingsModel(true); } base.Dispose(isManaged); }
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); } }
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); } }
/// <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"); }; }
/// <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); }
protected override void Dispose(bool isManaged) { Settings = new ChannelSettingsModel(); base.Dispose(isManaged); }
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); } }
protected override void Dispose(bool isManaged) { if (isManaged) { messages.Clear(); ads.Clear(); settings = new ChannelSettingsModel(); } base.Dispose(isManaged); }