Exemplo n.º 1
0
        public UpdateWindow()
        {
            InitializeComponent();

            var assembly            = Assembly.GetAssembly(GetType());
            var updateableAttribute =
                assembly.GetCustomAttributes(typeof(UpdateableComponentAttribute), false) as UpdateableComponentAttribute[];

            if (updateableAttribute != null && updateableAttribute.Length > 0)
            {
                Trace.WriteLine(String.Format("{0} has update capabilities.", assembly.GetName().Name));
                UpdateableComponents.Add(new UpdateableComponent(assembly, updateableAttribute[0].UpdateInfoUrl));
            }

            Processor = new UpdateProcessor();
            Processor.UpdateComponentCompleted += Processor_UpdateComponentCompleted;
            WriteSatus("Checking for update...");
            foreach (UpdateableComponent component in UpdateableComponents)
            {
                Processor.UpdateComponentAsync(component, null);
            }
        }
Exemplo n.º 2
0
 private void AddComponentImmediate(GameComponent component)
 {
     if (Components.ContainsKey(component.GlobalID) && Components[component.GlobalID] != component)
     {
         throw new IndexOutOfRangeException("Component was added that already exists.");
     }
     else if (!Components.ContainsKey(component.GlobalID))
     {
         Components[component.GlobalID] = component;
         if (component is IUpdateableComponent)
         {
             var type = component.GetType();
             if (!UpdateableComponents.ContainsKey(type))
             {
                 UpdateableComponents.Add(type, new List <IUpdateableComponent>());
             }
             UpdateableComponents[type].Add(component as IUpdateableComponent);
         }
         if (component is IRenderableComponent)
         {
             RenderableComponents.Add(component as IRenderableComponent);
         }
     }
 }