Exemple #1
0
        /// <summary>
        /// Download missing medias.
        /// </summary>
        static void DownloadMedias(object sender, GXAsyncWork work, object[] parameters)
        {
            string[] list    = (string[])parameters[0];
            string   initDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "GXDLMSDirector");
            string   medias  = Path.Combine(initDir, "Medias");

            foreach (string it in list)
            {
                IGXUpdater updater = null;
                string     path    = Path.Combine(medias, Path.GetFileName(it));
                Assembly   asm     = null;
                //Check is there new version from the media.
                if (File.Exists(path))
                {
                    asm = Assembly.LoadFile(path);
                    foreach (Type type in asm.GetTypes())
                    {
                        if (!type.IsAbstract && type.IsClass && typeof(IGXUpdater).IsAssignableFrom(type))
                        {
                            updater = Activator.CreateInstance(type) as IGXUpdater;
                            break;
                        }
                    }
                    if (updater != null && GXExternalMediaForm.CheckUpdates(updater, asm))
                    {
                        //TODO: Show that there are new updates.
                    }
                }
                else
                {
                    //If external media is missing.
                    GXExternalMediaForm.DownLoadMedia(it);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Download media updates.
        /// </summary>
        static void DownloadMediaUpdates(object sender, GXAsyncWork work, object[] parameters)
        {
            IGXUpdater updater = (IGXUpdater)parameters[0];
            Assembly   asm     = (Assembly)parameters[1];

            GXExternalMediaForm.CheckUpdates(updater, asm);
        }
Exemple #3
0
        void CheckUpdates(object sender, GXAsyncWork work, object[] parameters)
        {
            IGXUpdater updater = (IGXUpdater)parameters[0];
            Assembly   asm     = (Assembly)parameters[1];

            if (!GXExternalMediaForm.CheckUpdates(updater, asm))
            {
                // There's nothing to update
                MessageBox.Show(Properties.Resources.ExternalMediaNoUpdates, Properties.Resources.GXDLMSDirectorTxt, MessageBoxButtons.OK);
            }
            else
            {
                if (MessageBox.Show("You need to restart application. Do you want to do it now?", Properties.Resources.GXDLMSDirectorTxt, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Application.Restart();
                }
            }
        }