private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { var timer = (System.Timers.Timer)sender; timer.Interval = 30000; timer.Enabled = false; if (_currentuser != null) { var messages = Messages.Get(_currentuser); if (messages != null) { foreach (var message in messages) { Dispatcher.BeginInvoke(new Action(() => { int i = messageCenter.Notifications.ToList().FindIndex(x => x.Data.Id == message.Id); if (i >= 0) { var msg = messageCenter.Notifications[i]; if (message.ReadTimestamp.HasValue) { msg.Read = true; } else { msg.Read = false; } } else { var msg = new Controls.Message_Center.MessageData(message); messageCenter.AddMessage(msg); } messageCenter.CheckForMessages(); }), System.Windows.Threading.DispatcherPriority.Background, new object[] { }); } } timer.Enabled = true; } else { timer.Enabled = false; timer = null; } }
private void AddWelcomeMessage() { if (Properties.Settings.Default.FirstOpen) { // Add Notification to Message Center var message = new Controls.Message_Center.MessageData(); message.Title = "Welcome to TrakHound!"; message.Text = "Click to view Help on Getting Started"; message.Type = TrakHound.API.Messages.MessageType.TRAKHOUND_PRIVATE; message.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/TrakHound-Dashboard;component/Resources/TrakHound_Logo_Initials_10_30px.png")); message.Action = new Action <object>(WelcomeMessage_Clicked); messageCenter.AddMessage(message); Properties.Settings.Default.FirstOpen = false; Properties.Settings.Default.Save(); } }
/// <summary> /// Load Plugin if Enabled /// </summary> /// <param name="config"></param> public void Plugin_Load(PluginConfiguration config) { ///Check if Enabled if (config.Enabled) { var plugin = Plugins.Find(x => x.Title == config.Name && x.ParentPlugin == config.Parent && x.ParentPluginCategory == config.Category ); if (plugin != null) { try { // Assign event handlers plugin.SendData += Plugin_SendData; // Process SubPlugins plugin.SubCategories = config.SubCategories; Plugin_LoadSubPlugins(config); // Initialize plugin plugin.Initialize(); // If set to OpenOnStartUp then Open new Tab if (plugin.OpenOnStartUp) { AddTab(plugin); } // Create an Options page (if exists) Plugin_CreateOptionsPage(plugin); } catch (Exception ex) { var mData = new Controls.Message_Center.MessageData(); mData.Title = "Plugin Error"; mData.Text = "Error during plugin load"; mData.AdditionalInfo = ex.Message; mData.Type = TrakHound.API.Messages.MessageType.TRAKHOUND_ALERT; messageCenter.AddMessage(mData); } } } }
private void CheckVersion() { // v1.4.3 Regenerate Device Configuration Notice Version version = null; if (Version.TryParse(Properties.Settings.Default.LastVersion, out version)) { if (version < new Version("1.4.3")) { var u = new UpdateNotification(); u.mw = this; u.Show(); u.Focus(); } } // Build Information System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); version = assembly.GetName().Version; string format = "{0}.{1}.{2}"; string s = string.Format(format, version.Major, version.Minor, version.Build); string last = Properties.Settings.Default.LastVersion; if (last != "intial" && last != s) { Properties.Settings.Default.LastVersion = s; Properties.Settings.Default.Save(); // Add Notification to Message Center var message = new Controls.Message_Center.MessageData(); message.Title = "TrakHound Updated to " + s; message.Text = "TrakHound Successfully Updated from " + last + " to " + s; message.Type = Messages.MessageType.TRAKHOUND_UPDATE; message.Image = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/TrakHound-Dashboard;component/Resources/Update_01.png")); messageCenter.AddMessage(message); } }