Esempio n. 1
0
        private void BeginStart(object host)
        {
            OMLApplication.DebugLine("[Launch] Launch called");
            if (TestDBConnection((AddInHost)host))
            {
                DeleteOldRegistryKey((AddInHost)host);

                if (app == null)
                {
                    OMLApplication.DebugLine("[Launch] No Application found, creating...");
                    app = new OMLApplication(s_session, (AddInHost)host);
                }

                try
                {
                    if (OMLApplication.Current.IsExtender)
                    {
                        this.imp = new Impersonator();
                        this.imp.Enter();
                    }
                }
                catch (Exception ex)
                {
                    OMLApplication.DebugLine("Exception during this.imp.Enter(): {0}", ex);
                }

                app.Startup(_id);
            }
            else
            {
                //just going to do a retry for now-need to allow db change later...
                List <string> buttons = new List <string>();
                buttons.Add("Retry");
                buttons.Add("Cancel");
                Microsoft.MediaCenter.DialogResult res = ((AddInHost)host).MediaCenterEnvironment.Dialog("Unable to communicate with database. Would you like to retry or cancel?", "OPEN MEDIA LIBRARY", buttons, -1, true, null, delegate(Microsoft.MediaCenter.DialogResult dialogResult) { });
                if ((int)res == 100)
                {
                    Microsoft.MediaCenter.UI.Application.DeferredInvoke(new Microsoft.MediaCenter.UI.DeferredHandler(this.BeginStart), (object)host, new TimeSpan(1));
                }
                else
                {
                    s_session.Close();
                }
            }
        }
Esempio n. 2
0
        private void BeginStart(object host)
        {
            OMLApplication.DebugLine("[Launch] Launch called");
            if (TestDBConnection((AddInHost)host))
            {
                DeleteOldRegistryKey((AddInHost)host);

                if (app == null)
                {
                    OMLApplication.DebugLine("[Launch] No Application found, creating...");
                    app = new OMLApplication(s_session, (AddInHost)host);
                }

                try
                {
                    if (OMLApplication.Current.IsExtender)
                    {
                        this.imp = new Impersonator();
                        this.imp.Enter();
                    }
                }
                catch (Exception ex)
                {
                    OMLApplication.DebugLine("Exception during this.imp.Enter(): {0}", ex);
                }

                app.Startup(_id);
            }
            else
            {
                //just going to do a retry for now-need to allow db change later...
                List<string> buttons = new List<string>();
                buttons.Add("Retry");
                buttons.Add("Cancel");
                Microsoft.MediaCenter.DialogResult res = ((AddInHost)host).MediaCenterEnvironment.Dialog("Unable to communicate with database. Would you like to retry or cancel?", "OPEN MEDIA LIBRARY", buttons, -1, true, null, delegate(Microsoft.MediaCenter.DialogResult dialogResult) { });
                if ((int)res == 100)
                {
                    Microsoft.MediaCenter.UI.Application.DeferredInvoke(new Microsoft.MediaCenter.UI.DeferredHandler(this.BeginStart), (object)host, new TimeSpan(1));
                }
                else
                {
                    s_session.Close();
                }
            }
        }