public object Clone() { CapabilityViewerClassHashtable cvcHT = new CapabilityViewerClassHashtable(); foreach( DictionaryEntry de in Dictionary ) cvcHT.Add( (MSR.LST.ConferenceXP.PayloadType)de.Key, (Type)de.Value); return cvcHT; }
public object Clone() { CapabilityViewerClassHashtable cvcHT = new CapabilityViewerClassHashtable(); foreach (DictionaryEntry de in Dictionary) { cvcHT.Add((MSR.LST.ConferenceXP.PayloadType)de.Key, (Type)de.Value); } return(cvcHT); }
private static void AddCapabilityViewerClass(string fileName, Type type, string capName, CapabilityViewerClassHashtable capabilityViewerClasses, Capability.PayloadTypeAttribute pt, RegistryKey rtdocskey) { try { // Handle RTDocs as a special case. // We checked for a default setting in app.config earlier. // If we haven't loaded an RTDocs viewer yet, check the registry // to see if the current one is the default viewer. If it is // load it. If it isn't in the registry, add it as non-default. // If there are no entries in the registry, the first viewer wins. // It is possible to get into a state where the default viewer // in the registry is uninstalled from the machine, in which case // we are in trouble, because they will all be non-default. if (pt.PayloadType.ToString() == "RTDocument") { // No RTDocs capability viewer has been loaded if (!capabilityViewerClasses.ContainsKey(pt.PayloadType)) { // See if this one is listed as the default in the registry if (rtdocskey.ValueCount > 0) { object cpentry = rtdocskey.GetValue(capName); if (cpentry != null) // There is a registry entry for this capability { if (cpentry.ToString() == "default") { capabilityViewerClasses.Add(pt.PayloadType, type); } } else // No registry entry for this capability { // add to registry, but don't load rtdocskey.SetValue(capName, "non-default"); } } else // No entries in registry. First one wins. { rtdocskey.SetValue(capName, "default"); capabilityViewerClasses.Add(pt.PayloadType, type); } } else // An RTDocs capability viewer has already been loaded { // Mark the current one as non-default in the registry rtdocskey.SetValue(capName, "non-default"); } } else { if (!capabilityViewerClasses.ContainsKey(pt.PayloadType)) { capabilityViewerClasses.Add(pt.PayloadType, type); } else { string msg = string.Format( "Multiple capability viewers exist for payload type - {0}. \r\n" + "ConferenceXP selected {1} and will ignore {2}", pt.PayloadType, capabilityViewerClasses[pt.PayloadType].Name, capName); MessageBox.Show(msg, "Duplicate Capability Viewers Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception e) { string msg = "Accessing file " + fileName + "\n" + e.ToString(); eventLog.WriteEntry(msg, EventLogEntryType.Error, 99); MessageBox.Show(msg, "Error Initializing Capability Viewer", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private static void AddCapabilityViewerClass(string fileName, Type type, string capName, CapabilityViewerClassHashtable capabilityViewerClasses, Capability.PayloadTypeAttribute pt, RegistryKey rtdocskey) { try { // Handle RTDocs as a special case. // We checked for a default setting in app.config earlier. // If we haven't loaded an RTDocs viewer yet, check the registry // to see if the current one is the default viewer. If it is // load it. If it isn't in the registry, add it as non-default. // If there are no entries in the registry, the first viewer wins. // It is possible to get into a state where the default viewer // in the registry is uninstalled from the machine, in which case // we are in trouble, because they will all be non-default. if (pt.PayloadType.ToString() == "RTDocument") { // No RTDocs capability viewer has been loaded if (!capabilityViewerClasses.ContainsKey(pt.PayloadType)) { // See if this one is listed as the default in the registry if (rtdocskey.ValueCount > 0) { object cpentry = rtdocskey.GetValue(capName); if (cpentry != null) // There is a registry entry for this capability { if (cpentry.ToString() == "default") { capabilityViewerClasses.Add(pt.PayloadType, type); } } else // No registry entry for this capability { // add to registry, but don't load rtdocskey.SetValue(capName, "non-default"); } } else // No entries in registry. First one wins. { rtdocskey.SetValue(capName, "default"); capabilityViewerClasses.Add(pt.PayloadType, type); } } else // An RTDocs capability viewer has already been loaded { // Mark the current one as non-default in the registry rtdocskey.SetValue(capName, "non-default"); } } else { if (!capabilityViewerClasses.ContainsKey(pt.PayloadType)) { capabilityViewerClasses.Add(pt.PayloadType, type); } else { string msg = string.Format(CultureInfo.CurrentCulture, Strings.MultipleCapabilityViewersExist, pt.PayloadType, capabilityViewerClasses[pt.PayloadType].Name, capName); RtlAwareMessageBox.Show(null, msg, Strings.DuplicateCapabilityViewersDetected, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } } } catch (Exception e) { string msg = string.Format(CultureInfo.CurrentCulture, Strings.AccessingFile, fileName, e.ToString()); eventLog.WriteEntry(msg, EventLogEntryType.Error, 99); RtlAwareMessageBox.Show(null, msg, Strings.ErrorInitializingCapabilityViewer, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } }