Interaction logic for UpdateNotification.xaml
Inheritance: System.Windows.Window
示例#1
0
        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);
            }
        }
        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);
            }
        }