Exemplo n.º 1
0
        public HResult Register(string document, INiHierarchy hier, INiPersistDocData docData, out int cookie)
        {
            cookie = -1;

            try
            {
                if (document == null)
                {
                    throw new ArgumentNullException("document");
                }
                if (docData == null)
                {
                    throw new ArgumentNullException("docData");
                }

                cookie = Interlocked.Increment(ref _lastCookie);

                _registrations.Add(cookie, new Registration(document, hier, docData));

                return(HResult.OK);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
Exemplo n.º 2
0
            public OpenDocument(NiOpenDocumentManager manager, string document, INiHierarchy item, INiWindowFrame windowFrame, int rdtCookie, INiPersistDocData docData)
            {
                _manager    = manager;
                _rdtCookie  = rdtCookie;
                _docData    = docData;
                Document    = document;
                Item        = item;
                WindowFrame = windowFrame;

                new Listener(this);

                if (docData != null)
                {
                    ErrorUtil.ThrowOnFailure(windowFrame.GetCaption(out _initialCaption));

                    UpdateDirtyFlag();

                    ((NiShell)manager.GetService(typeof(INiShell))).RequerySuggested += OpenDocument_RequerySuggested;
                }
            }
Exemplo n.º 3
0
        public HResult GetDocumentInfo(int cookie, out string document, out INiHierarchy hier, out INiPersistDocData docData)
        {
            document = null;
            hier     = null;
            docData  = null;

            try
            {
                Registration registration;
                if (!_registrations.TryGetValue(cookie, out registration))
                {
                    throw new ArgumentOutOfRangeException("cookie", NeutralResources.DocumentNotRegistered);
                }

                document = registration.Document;
                hier     = registration.Item;
                docData  = registration.DocData;

                return(HResult.OK);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
Exemplo n.º 4
0
 public Registration(string document, INiHierarchy item, INiPersistDocData docData)
 {
     Document = document;
     Item     = item;
     DocData  = docData;
 }