public static void Show(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedObject, PropertyDataUpdated dataUpdatedDelegate, Status Status) { using (CollevalStatisticsDialog dialog = new CollevalStatisticsDialog(action, scopeNode)) { dialog.ShowDialog(); return; } }
private static void DeleteDeployment(object sender, IResultObject selectedResultObject, PropertyDataUpdated dataUpdatedDelegate, string displayPropertyName, bool confirmDialog = true) { IResultObject deploymentFromSummarizer = Utilities.GetCorrespondingDeploymentFromSummarizer(selectedResultObject); if (confirmDialog) { if (System.Windows.MessageBox.Show(string.Format("Delete the selected '{0}' deployment?", selectedResultObject[displayPropertyName].StringValue), "Configuration Manager", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) != MessageBoxResult.Yes) { return; } } deploymentFromSummarizer.Delete(); List <PropertyDataUpdateItem> refreshDataList = new List <PropertyDataUpdateItem> { new PropertyDataUpdateItem(selectedResultObject, PropertyDataUpdateAction.Delete) }; if (dataUpdatedDelegate == null) { return; } dataUpdatedDelegate(sender, refreshDataList); }
public static void ExecuteMultiSelectAction(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject resultObject, PropertyDataUpdated dataUpdatedDelegate, Status status) { if (resultObject.Count > 0) { subName = resultObject.DisplayString; } GetExecutableActionByName(action.DisplayName); }
public static void AddMulitDeviceCollection(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedObject, PropertyDataUpdated dataUpdatedDelegate, Status Status) { try { using (BrowseCollectionDialog collectionDialog = new BrowseCollectionDialog(selectedObject.ConnectionManager)) { collectionDialog.MultiSelect = true; collectionDialog.CollectionType = CollectionType.Device; collectionDialog.CollectionFilter = (collectionResultObject => { if (collectionResultObject["IsReferenceCollection"].BooleanValue || collectionResultObject["IsBuiltIn"].BooleanValue) { return(false); } if (selectedObject.Count > 1) { foreach (IResultObject resultObject in selectedObject) { if (resultObject.ObjectClass == "SMS_Collection" && resultObject["CollectionID"].StringValue == collectionResultObject["CollectionID"].StringValue) { return(false); } } return(true); } return(!(selectedObject.ObjectClass == "SMS_Collection") || !(selectedObject["CollectionID"].StringValue == collectionResultObject["CollectionID"].StringValue)); }); if (collectionDialog.ShowDialog() != DialogResult.OK) { return; } foreach (IResultObject collection in collectionDialog.SelectedCollections) { List <IResultObject> list = new List <IResultObject>(); foreach (IResultObject item in selectedObject) { IResultObject instance = selectedObject.ConnectionManager.CreateEmbeddedObjectInstance("SMS_CollectionRuleDirect"); instance["ResourceClassName"].StringValue = "SMS_R_System"; instance["RuleName"].StringValue = item["Name"].StringValue; instance["ResourceID"].IntegerValue = item["ResourceID"].IntegerValue; list.Add(instance); } collection.ExecuteMethod("AddMembershipRules", new Dictionary <string, object>() { { "collectionRules", list } }); } } } catch (SmsQueryException ex) { SccmExceptionDialog.ShowDialog(SnapIn.Console, ex); } }
public static void DeleteDeploymentForMonitoring(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedResultObject, PropertyDataUpdated dataUpdatedDelegate, Status status) { DeleteDeployment(sender, selectedResultObject, dataUpdatedDelegate, "SoftwareName"); }
public static void RunTaskSequenceExport(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedResultObjects, PropertyDataUpdated dataUpdatedDelegate, Status status) { using (XmlReader readerFromString = SecureXml.CreateXmlReaderFromString(selectedResultObjects["Sequence"].StringValue)) { XElement taskSequencePackage = new XElement("TaskSequencePackage", new XElement("PackageID", selectedResultObjects["PackageID"].StringValue), new XElement("BootImageID", selectedResultObjects["BootImageID"].StringValue), new XElement("Category", selectedResultObjects["Category"].StringValue), new XElement("DependentProgram", selectedResultObjects["DependentProgram"].StringValue), new XElement("Description", selectedResultObjects["Description"].StringValue), new XElement("Duration", selectedResultObjects["Duration"].IntegerValue), new XElement("Name", selectedResultObjects["Name"].StringValue), new XElement("SourceDate", selectedResultObjects["SourceDate"].DateTimeValue), new XElement("SequenceData", XElement.Load(readerFromString) ) ); SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "XML files(.xml)|*.xml", Title = "Export Task Sequnce to XML", FileName = selectedResultObjects["PackageID"].StringValue }; saveFileDialog1.ShowDialog(); if (saveFileDialog1.FileName != "") { taskSequencePackage.Save(saveFileDialog1.FileName); } } }
public static void RunClientActionRestartService(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedResultObjects, PropertyDataUpdated dataUpdatedDelegate, Status status) { // set the thread pool method to run method = "RestartServiceAsync"; ProcessAction(scopeNode, action, selectedResultObjects); }
public static void RunClientAction(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedResultObjects, PropertyDataUpdated dataUpdatedDelegate, Status status) { // set the thread pool method to run method = "ClientAction"; // check if we need full scan if (!string.IsNullOrEmpty(action.DialogId)) { string[] tmp = action.DialogId.Split(','); scheduleId = tmp[0]; fullScan = tmp.Length > 1 ? true : false; } ProcessAction(scopeNode, action, selectedResultObjects); }
//private static DeviceProgressDialog deviceProgressDialog; public static void ChangeClientCache(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedResultObjects, PropertyDataUpdated dataUpdatedDelegate, Status status) { bool showProgressDialog = false; if (selectedResultObjects.ObjectClass == "SMS_Collection" || selectedResultObjects.Count > 1) { showProgressDialog = true; } int total = selectedResultObjects.Count; if (selectedResultObjects.ObjectClass == "SMS_Collection") { try { total = 0; string query = string.Format("SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID='{0}'", selectedResultObjects["CollectionID"].StringValue); // query processor does not have count implemented?!?!? foreach (IResultObject tmp in selectedResultObjects.ConnectionManager.QueryProcessor.ExecuteQuery(query)) { total++; } selectedResultObjects = selectedResultObjects.ConnectionManager.QueryProcessor.ExecuteQuery(query); } catch (SmsQueryException ex) { SccmExceptionDialog.ShowDialog(SnapIn.Console, ex); return; } } if (showProgressDialog) { MessageBox.Show("Not implemented yet!", "Configuration Manager", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); //Type type = typeof(ClientCache); //MethodInfo methodInfo = type.GetMethod("ChangeClientCacheSize"); //deviceProgressDialog = new DeviceProgressDialog(action, selectedResultObjects, methodInfo) //{ // Total = total //}; //deviceProgressDialog.ShowDialog(); } else { Utility.ShowDialog("QuickToolsDeviceCache", selectedResultObjects); } }
public static void RunGetProvisioningMode(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedResultObjects, PropertyDataUpdated dataUpdatedDelegate, Status status) { ProcessProvisioningMode(scopeNode, action, selectedResultObjects, false); }