Beispiel #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="name"></param>
        /// <param name="selection"></param>
        public UpdateObject(updaterSettingsData settings)
        {
            this.settings = settings;


            // Init the States
            this.NewestVersionInstalled = false;
        }
Beispiel #2
0
        /// <summary>
        /// Update object with settings. Used if the running application is the only application to be updated without an settings file
        /// </summary>
        /// <param name="position">position where the pop up window should be displayed</param>
        /// <param name="updaterSettings"></param>
        public UpdaterView(Point position, updaterSettingsData updaterSettings)
        {
            this.windowStartPosistion = position;

            InitializeComponent();
            viewModel        = new UpdaterViewModel(updaterSettings);
            this.DataContext = viewModel;
        }
Beispiel #3
0
        /// <summary>
        /// Updater view model with updater settings directly handling over
        /// </summary>
        /// <param name="updaterSettings">Updater settings with all needed information to update the currently running application</param>
        public UpdaterViewModel(updaterSettingsData updaterSettings)
        {
            // Create a new observable collection
            UpdatableObject = new UpdateObject(updaterSettings);

            StatusBarBackground = Brushes.Orange;
            StatusBarText       = "Checking for available updates";

            updater = new Updater(UpdatableObject);
            updater.UpdateStateChanged += UpdaterStatusUpdate;
        }
Beispiel #4
0
        /// <summary>
        /// Update object with settings. Used if the running application is the only application to be updated without an settings file
        /// </summary>
        /// <param name="position">position where the pop up window should be displayed</param>
        /// <param name="updaterSettings"></param>
        public UpdaterView(Point position, updaterSettingsData updaterSettings, BitmapImage windowIcon)
        {
            this.windowStartPosistion = position;

            InitializeComponent();
            viewModel        = new UpdaterViewModel(updaterSettings);
            this.DataContext = viewModel;

            // Change the icon if teh window icon is transmitted
            if (windowIcon != null)
            {
                this.Icon = windowIcon;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Load the settings and return the params
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static List <updaterSettingsData> load(string filePath, string localPath)
        {
            List <updaterSettingsData> settingsData = new List <updaterSettingsData>();

            // Try to read the Settings File
            XmlDocument doc = new XmlDocument();// Create a new XmlDocumentObject

            // Try to find the Settingsfile
            if (!File.Exists(filePath))
            {
                Console.WriteLine("No Settingsfile found. Please create settings file first and restart the application");
            }
            else
            {
                try
                {
                    Console.WriteLine("Start doc load");
                    // open the XML File
                    doc.Load(filePath);//Load the XML Data

                    Console.WriteLine("get the node list");

                    // Read
                    XmlNodeList nodeList = doc.DocumentElement.SelectNodes("app");

                    Console.WriteLine("Get the app entry elements from the node list");
                    foreach (XmlNode appEntry in nodeList)
                    {
                        //appEntry.SelectSingleNode
                        updaterSettingsData appData = new updaterSettingsData();

                        appData.appName            = appEntry.SelectSingleNode("name").InnerText;
                        appData.appFileName        = appEntry.SelectSingleNode("appFileName").InnerText;
                        appData.appLocalPath       = localPath + @"\" + appEntry.SelectSingleNode("appLocalPath").InnerText;
                        appData.appServerPath      = appEntry.SelectSingleNode("appServerPath").InnerText;
                        appData.settingsFileName   = appEntry.SelectSingleNode("settingsFileName").InnerText;
                        appData.settingsLocalPath  = localPath + @"\" + appEntry.SelectSingleNode("settingsLocalPath").InnerText;
                        appData.settingsServerPath = appEntry.SelectSingleNode("settingsServerPath").InnerText;
                        settingsData.Add(appData);
                    }
                }
                catch (Exception err)
                {
                    Console.WriteLine("Error Occured during reading of the Settings file. Path: " + filePath + "\n\nError: " + err);
                }
            }

            return(settingsData);
        }
Beispiel #6
0
        /// <summary>
        /// Application update example
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btUpdater_Click(object sender, RoutedEventArgs e)
        {
            //Create new update settings object
            // Fill in the settings you need to reference to your application update path.
            WpfAppLib.Updater.updaterSettingsData _updaterSettings = new WpfAppLib.Updater.updaterSettingsData
            {
                appFileName        = "WpfExampleApp.exe",
                appLocalPath       = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\",
                appName            = Assembly.GetExecutingAssembly().GetName().Name,
                appServerPath      = @"U:\tmp\WpfExampleApp\bin\Debug\",
                settingsFileName   = "Settings.xml",
                settingsLocalPath  = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                settingsServerPath = @"U:\tmp\WpfExampleApp\bin\Debug\"
            };


            // Get the icon file from the resources
            var _windowIcon = new BitmapImage();

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WpfExampleApp.Resources.studie.png"))
            {
                _windowIcon.BeginInit();
                _windowIcon.StreamSource = stream;
                _windowIcon.CacheOption  = BitmapCacheOption.OnLoad;
                _windowIcon.EndInit();
                _windowIcon.Freeze();
            }

            // Create the updater object
            UpdaterView _myUpdateView = new UpdaterView(new Point(), _updaterSettings, null);

            // Change the texts of the ui elements
            //_myUpdateView.CheckUpdatesButtonText = "Loooooking";
            //_myUpdateView.UpdateButtonText = "Get down on it";
            //_myUpdateView.CancelButtonText = "Nope..";
            //_myUpdateView.LocalPathLabelText = "lo path";
            //_myUpdateView.LocalVersionLabelText = "lo ver";
            //_myUpdateView.RemotePathLabelText = "remo path";
            //_myUpdateView.RemoteVersionLabelText = "remo ver";
            //_myUpdateView.WindowTitleText = "Update dialog";

            // Show the updater object
            _myUpdateView.Show();
        }