Exemplo n.º 1
0
        private void CheckFirstRun(AddInHost host)
        {
            if (Properties.Settings.Default.ShowFirstRunPrompt == true)
            {
                List <string> buttons = new List <string>();
                buttons.Add("Configure OML");
                buttons.Add("No Thanks");
                Microsoft.MediaCenter.MediaCenterEnvironment env = host.MediaCenterEnvironment;
                string dialogText = "Would you like to configure Open Media Library now? To run this wizard later you can access OML from the program library.";
                Microsoft.MediaCenter.DialogResult res = env.Dialog(dialogText, "OPEN MEDIA LIBRARY", buttons, -1, true, null, delegate(Microsoft.MediaCenter.DialogResult dialogResult) { });
                if ((int)res == 100)
                {
                    //tmp until firstrun page
                    Properties.Settings.Default.ShowFirstRunPrompt = false;
                    Properties.Settings.Default.Save();

                    //run setup
                    s_session = new Library.Code.V3.HistoryOrientedPageSessionEx();
                    GoToLoader();
                    Microsoft.MediaCenter.UI.Application.DeferredInvoke(new Microsoft.MediaCenter.UI.DeferredHandler(this.BeginStart), (object)host, new TimeSpan(1));
                }
                else
                {
                    Properties.Settings.Default.ShowFirstRunPrompt = false;
                    Properties.Settings.Default.Save();
                    //env.Dialog("You can access OML from the program library.", "OPEN MEDIA LIBRARY", Microsoft.MediaCenter.DialogButtons.Ok, -1, true);
                }
            }
        }
Exemplo 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();
                }
            }
        }