public void AddGadget(string deployPath) { GadgetDeployDescription gdd = new GadgetDeployDescription(deployPath); string desc = string.Format("{0}({1})", gdd.Title, gdd.Description); XElement gadget = new XElement("Gadget"); gadget.SetAttributeValue("deployPath", deployPath); gadget.SetAttributeValue("Description", desc); Definition.XPathSelectElement("Package/Gadgets").Add(gadget); }
public GadgetGridRow(string deployPath) { Title = "讀取中..."; DeployPath = deployPath; Description = DeployPath; Task task = Task.Factory.StartNew(() => { try { DeployDescription = new GadgetDeployDescription(DeployPath); Title = DeployDescription.Title; Description = DeployDescription.Description; } catch (Exception ex) { Title = "讀取錯誤..."; Description = ex.Message; } }, System.Threading.CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default); }