コード例 #1
0
        public RTDocumentHelper ( Capability capability )
        {
            this.capability = capability;

            // Set up delegate that is used to send the slides on a background thread
            beginSendAllSlidesDelegate = new SendAllSlidesHandler(SendAllSlides);
        }
コード例 #2
0
        public RTDocumentHelper ( Capability capability, RTDocument rtDocument )
        {
            this.capability = capability;

            this.rtDocument = rtDocument;
            rtDocumentIdentifier = rtDocument.Identifier;

            // Set up delegate that is used to send the slides on a background thread
            beginSendAllSlidesDelegate = new SendAllSlidesHandler(SendAllSlides);
        }
コード例 #3
0
        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);
            }
        }