Ejemplo n.º 1
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 MultiUpdaterView(Point position, updaterSettingsData updaterSettings)
        {
            this.windowStartPosistion = position;

            InitializeComponent();
            viewModel        = new MultiUpdaterViewModel(updaterSettings);
            this.DataContext = viewModel;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="name"></param>
        /// <param name="selection"></param>
        public UpdateObject(updaterSettingsData settings)
        {
            this.settings = settings;


            // Init the States
            this.IsSelectedToDownload   = false;
            this.NewestVersionInstalled = false;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="updaterSettings">Update application settings</param>
        /// <param name="updatableObjects">collection of updatable files</param>
        public MultiUpdater(updaterSettingsData updaterSettings, ObservableCollection <UpdateObject> updatableObjects)
        {
            this.OwnApplicationName = updaterSettings.appName;
            this.UpdatableObjects   = updatableObjects;

            UpdatableObjects.Add(new UpdateObject(updaterSettings));

            // Check for Updates
            getVersionsAsynch();
        }
Ejemplo n.º 4
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 MultiUpdaterViewModel(updaterSettingsData updaterSettings)
        {
            // Create a new observable collection
            UpdatableObjects = new ObservableCollection <UpdateObject>();

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

            updater = new MultiUpdater(updaterSettings, UpdatableObjects);
            updater.UpdateStateChanged += UpdaterStatusUpdate;
        }
Ejemplo n.º 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);
        }