コード例 #1
0
 private void OnRegistrationMenuItem_Click(object sender, EventArgs e)
 {
     using (var dlg = new RegistrationDialog(true))
     {
         dlg.ShowDialog();
     }
 }
コード例 #2
0
        private static void CloseSplashScreenAndCheckRegistration()
        {
            if (_splashForm != null)
            {
                if (RegistrationDialog.ShouldWeShowRegistrationDialog())
                {
                    _splashForm.Hide();             //the fading was getting stuck when we showed the registration.
                }
                _splashForm.FadeAndClose();         //it's going to hang around while it fades,
                _splashForm = null;                 //but we are done with it
            }

            if (RegistrationDialog.ShouldWeShowRegistrationDialog())
            {
                using (var dlg = new RegistrationDialog(false))
                {
                    if (_projectContext != null && _projectContext.ProjectWindow != null)
                    {
                        dlg.ShowDialog(_projectContext.ProjectWindow);
                    }
                    else
                    {
                        dlg.ShowDialog();
                    }
                }
            }
        }
コード例 #3
0
        public MainWindow()
        {
            InitializeComponent();
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            if (UserRepository.IsUserRegistered())
            {
                var login       = new LoginDialog();
                var loginResult = login.ShowDialog();
                if (loginResult == null || loginResult == false)
                {
                    Application.Current.Shutdown();
                }
            }
            else
            {
                var registration       = new RegistrationDialog();
                var registrationResult = registration.ShowDialog();
                if (registrationResult == null || registrationResult == false)
                {
                    Application.Current.Shutdown();
                }
            }

            model       = new MainWindowModel(new Clock());
            DataContext = model;
        }
コード例 #4
0
 private void HandleShowRegistrationDialog(ApiRequest request)
 {
     using (var dlg = new RegistrationDialog(false))
     {
         dlg.ShowDialog();
     }
     request.PostSucceeded();
 }
コード例 #5
0
 private void HandleShowRegistrationDialog(ApiRequest request)
 {
     using (var dlg = new RegistrationDialog(false, _tcManager.UserMayChangeEmail))
     {
         dlg.ShowDialog();
     }
     request.PostSucceeded();
 }
コード例 #6
0
ファイル: GameMode.cs プロジェクト: 6yxau/GlobalSamp
        protected override void OnPlayerConnected(BasePlayer player, EventArgs e)
        {
            base.OnPlayerConnected(player, e);

            player.SendClientMessage($"Добро пожаловать в GlobalSamp, {player.Name}!");

            PlayerData data = PlayerManager.Instance.GetPlayerData(player.Name);

            var dialog = new RegistrationDialog(data != null);

            dialog.Response += dialog.OnInputRegistrationData;
            dialog.ShowAsync(player);
        }
コード例 #7
0
    public void AskForRegistration(string name, string id, string gcm)
    {
        DialogResult dialogResult = new RegistrationDialog(name, id, gcm).ShowDialog();

        Device device = null;
        if (dialogResult == DialogResult.OK) {
            device = new Device(name, id, gcm, true);
        } else if (dialogResult == DialogResult.No) {
            device = new Device(name, id, gcm, false);
        }
        _deviceManager.AddDevice(device);
        _deviceManager.SaveData();
    }
コード例 #8
0
ファイル: Program.cs プロジェクト: ralfw/instavote.open
        public Program()
        {
            var regDlg = new RegistrationDialog(this);
            var fbDlg = new FeedbackDialog(this);
            var tüDlg = new TrainingsübersichtDialog(this);
            var trDlg = new TrainingDialog(this);
            var rDlg = new RootDialog(this);

            regDlg.OnShowRequest += regDlg.Show;
            regDlg.OnRegistrationRequest += (tid, name, email) => {
                if (name == "x")
                    regDlg.Retry("someMatchcode", name, email, string.Format("Received: {0}, {1}, {2}", tid, name, email));
                else
                    regDlg.Ack("someMatchcode", name, email);
            };

            fbDlg.OnShowRequest += fbDlg.Show;
            fbDlg.OnFeedbackRequest += (tmatchcode, email, score, suggestions) =>
            {
                if (email == "x")
                    fbDlg.Retry(tmatchcode, email, score, suggestions, string.Format("Received: {0}, {1}, {2}, {3}", tmatchcode, email, score, suggestions));
                else
                    fbDlg.Ack(tmatchcode);
            };

            tüDlg.OnShowRequest += trainerMatchcode => tüDlg.Show(trainerMatchcode,
                new[] { new Tuple<string, string>("1", "training1"), new Tuple<string, string>("2", "training2") }, 
                "");
            tüDlg.OnTrainingCreationRequest += (trainerMatchcode, newTrainingMatchcode) => tüDlg.Show(trainerMatchcode, new[] { new Tuple<string, string>("1", "training1"), new Tuple<string, string>("2", "training2"), new Tuple<string, string>("3", newTrainingMatchcode), },
                                                                                                                    newTrainingMatchcode == "x" ? "Training matchcode already existent." : "");

            trDlg.OnShowRequest += trainingId =>
                {
                    var ti = new TrainingInfo {
                        Matchcode = "someTraining",
                        Votes = new[]
                            {
                                new VoteInfo {Name = "n1", Email = "e1@", Score = 6, Suggestions = "s1"},
                                new VoteInfo {Name = "n2", Email = "e2@", Score = 7, Suggestions = "s2"},
                            },
                        AverageScore = 6.5
                    };
                    trDlg.Show(ti);
                };

            Get["/hello"] = _ => "Hello from instavote.dialogs.tests, " + DateTime.Now;
        }
コード例 #9
0
    public void AskForRegistration(string name, string id, string gcm)
    {
        DialogResult dialogResult = new RegistrationDialog(name, id, gcm).ShowDialog();

        Device device = null;

        if (dialogResult == DialogResult.OK)
        {
            device = new Device(name, id, gcm, true);
        }
        else if (dialogResult == DialogResult.No)
        {
            device = new Device(name, id, gcm, false);
        }
        _deviceManager.AddDevice(device);
        _deviceManager.SaveData();
    }
コード例 #10
0
        public DialogsProvider(Config.RawData.DialogsContainer root)
        {
            Dialogs      = new List <Dialog>();
            DialogsTable = new Dictionary <string, Dialogs.Dialog>();

            // fill support buttons
            SupportButtons = new Dictionary <string, Button>();
            foreach (var btn in root.SupportButtons)
            {
                try
                {
                    var    type   = Type.GetType(btn.Type);
                    Button button = Activator.CreateInstance(type, btn) as Button;
                    SupportButtons.Add(btn.Id, button);
                }
                catch (Exception e)
                {
                    BotManager.Core?.LogController?.LogWarning(new DebugMessage($"Couldn't convert support button '{btn.Id}'", "DialogsProvider()", e));
                }
            }

            // create root dialog
            try
            {
                RootDialog = new RootDialog(root as Config.RawData.Dialog);
                RootDialog.GetEditable().SupportButtons = GetButtons(root.Buttons);

                RegistrationDialog = new RegistrationDialog(root.RegistrationDialog, null);
                RegistrationDialog.GetEditable().SupportButtons = GetButtons(root.RegistrationDialog.Buttons);

                DialogsTable.Add(RootDialog.Id, RootDialog);
                Dialogs.Add(RootDialog);
                DialogsTable.Add(RegistrationDialog.Id, RegistrationDialog);
                Dialogs.Add(RegistrationDialog);
            }
            catch (Exception e)
            {
                BotManager.Core?.LogController?.LogCritical(new DebugMessage($"Couldn't initialize root dialog!", "DialogsProvider()", e));
                throw e;
            }

            // fill other dialogs and bind supportButtons
            RootDialog.GetEditable().Dialogs         = DialogInitializer(root, RootDialog);
            RegistrationDialog.GetEditable().Dialogs = DialogInitializer(root.RegistrationDialog, RegistrationDialog);
        }
コード例 #11
0
        static void Main(string[] args)
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (Palaso.PlatformUtilities.Platform.IsWindows)
                {
                    OldVersionCheck();
                }
                //bring in settings from any previous version
                if (Settings.Default.NeedUpgrade)
                {
                    //see http://stackoverflow.com/questions/3498561/net-applicationsettingsbase-should-i-call-upgrade-every-time-i-load
                    Settings.Default.Upgrade();
                    Settings.Default.Reload();
                    Settings.Default.NeedUpgrade = false;
                    Settings.Default.Save();
                    StartUpWithFirstOrNewVersionBehavior = true;
                }
#if !USING_CHORUS
                Settings.Default.ShowSendReceive = false;                 // in case someone turned it on before we disabled
#endif
#if DEBUG
                if (args.Length > 0)
                {
                    // This allows us to debug things like  interpreting a URL.
                    MessageBox.Show("Attach debugger now");
                }
#endif

#if DEBUG
                using (new DesktopAnalytics.Analytics("sje2fq26wnnk8c2kzflf", RegistrationDialog.GetAnalyticsUserInfo(), true))
#else
                string feedbackSetting = System.Environment.GetEnvironmentVariable("FEEDBACK");

                //default is to allow tracking
                var allowTracking = string.IsNullOrEmpty(feedbackSetting) || feedbackSetting.ToLower() == "yes" || feedbackSetting.ToLower() == "true";

                using (new Analytics("c8ndqrrl7f0twbf2s6cv", RegistrationDialog.GetAnalyticsUserInfo(), allowTracking))
#endif

                {
                    if (args.Length == 1 && args[0].ToLower().EndsWith(".bloompack"))
                    {
                        SetUpErrorHandling();
                        _applicationContainer = new ApplicationContainer();
                        SetUpLocalization();
                        var path = args[0];
                        // This allows local links to bloom packs.
                        if (path.ToLowerInvariant().StartsWith("bloom://"))
                        {
                            path = path.Substring("bloom://".Length);
                            if (!File.Exists(path))
                            {
                                path = FileLocator.GetFileDistributedWithApplication(true, path);
                                if (!File.Exists(path))
                                {
                                    return;
                                }
                            }
                        }
                        using (var dlg = new BloomPackInstallDialog(path))
                        {
                            dlg.ShowDialog();
                        }
                        return;
                    }
                    if (IsBloomBookOrder(args))
                    {
                        // We will start up just enough to download the book. This avoids the code that normally tries to keep only a single instance running.
                        // There is probably a pathological case here where we are overwriting an existing template just as the main instance is trying to
                        // do something with it. The time interval would be very short, because download uses a temp folder until it has the whole thing
                        // and then copies (or more commonly moves) it over in one step, and making a book from a template involves a similarly short
                        // step of copying the template to the new book. Hopefully users have (or will soon learn) enough sense not to
                        // try to use a template while in the middle of downloading a new version.
                        SetUpErrorHandling();
                        _applicationContainer = new ApplicationContainer();
                        SetUpLocalization();
                        Logger.Init();
                        new BookDownloadSupport();
                        Browser.SetUpXulRunner();
                        L10NSharp.LocalizationManager.SetUILanguage(Settings.Default.UserInterfaceLanguage, false);
                        var transfer = new BookTransfer(new BloomParseClient(), ProjectContext.CreateBloomS3Client(),
                                                        _applicationContainer.HtmlThumbnailer, new BookDownloadStartingEvent()) /*not hooked to anything*/;
                        transfer.HandleBloomBookOrder(args[0]);
                        PathToBookDownloadedAtStartup = transfer.LastBookDownloadedPath;
                        // If another instance is running, this one has served its purpose and can exit right away.
                        // Otherwise, carry on with starting up normally.
                        if (TryToGrabMutexForBloom())
                        {
                            FinishStartup();
                        }
                        else
                        {
                            _onlyOneBloomMutex = null;                             // we don't own it, so ReleaseMutexForBloom must not try to release it.
                            string caption = LocalizationManager.GetString("Download.CompletedCaption", "Download complete");
                            string message = LocalizationManager.GetString("Download.Completed",
                                                                           @"Your download ({0}) is complete. You can see it in the 'Books from BloomLibrary.org' section of your Collections. "
                                                                           + "If you don't seem to be in the middle of doing something, Bloom will select it for you.");
                            message = string.Format(message, Path.GetFileName(PathToBookDownloadedAtStartup));
                            MessageBox.Show(message, caption);
                        }
                        return;
                    }

                    if (!GrabMutexForBloom())
                    {
                        return;
                    }

                    OldVersionCheck();

                    SetUpErrorHandling();

                    _applicationContainer = new ApplicationContainer();

                    if (args.Length == 2 && args[0].ToLowerInvariant() == "--upload")
                    {
                        // A special path to upload chunks of stuff. This is not currently documented and is not very robust.
                        // - User must log in before running this
                        // - For best results each bloom book needs to be part of a collection in its parent folder
                        // - little error checking (e.g., we don't apply the usual constaints that a book must have title and licence info)
                        SetUpLocalization();
                        Browser.SetUpXulRunner();
                        var transfer = new BookTransfer(new BloomParseClient(), ProjectContext.CreateBloomS3Client(),
                                                        _applicationContainer.HtmlThumbnailer, new BookDownloadStartingEvent()) /*not hooked to anything*/;
                        transfer.UploadFolder(args[1], _applicationContainer);
                        return;
                    }

                    new BookDownloadSupport();                     // creating this sets some things up so we can download.

                    SetUpLocalization();
                    Logger.Init();


                    if (args.Length == 1)
                    {
                        Debug.Assert(args[0].ToLower().EndsWith(".bloomcollection"));                         // Anything else handled above.
                        Settings.Default.MruProjects.AddNewPath(args[0]);
                    }

                    if (args.Length > 0 && args[0] == "--rename")
                    {
                        try
                        {
                            var pathToNewCollection = CollectionSettings.RenameCollection(args[1], args[2]);
                            //MessageBox.Show("Your collection has been renamed.");
                            Settings.Default.MruProjects.AddNewPath(pathToNewCollection);
                        }
                        catch (ApplicationException error)
                        {
                            Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error, error.Message);
                            Environment.Exit(-1);
                        }
                        catch (Exception error)
                        {
                            Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error,
                                                                             "Bloom could not finish renaming your collection folder. Restart your computer and try again.");
                            Environment.Exit(-1);
                        }
                    }
                    Browser.SetUpXulRunner();
#if DEBUG
                    StartDebugServer();
#endif
                    L10NSharp.LocalizationManager.SetUILanguage(Settings.Default.UserInterfaceLanguage, false);

                    FinishStartup();
                }
            }
            finally
            {
                ReleaseMutexForBloom();
            }
        }
コード例 #12
0
 /*************************************/
 /*   Register User                   */
 /*************************************/
 public void register()
 {
     RegistrationDialog reg = new RegistrationDialog(currForumId);
     reg.ShowDialog();
     if (reg.getUserName() != null)
     {
         loginLevel = 0;
         updateVisibilty();
         setStatusMsg("New User Was Registered!");
     }
 }
コード例 #13
0
ファイル: Program.cs プロジェクト: BloomBooks/testBloom
        static void Main(string[] args)
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                //bring in settings from any previous version
                if (Settings.Default.NeedUpgrade)
                {
                    //see http://stackoverflow.com/questions/3498561/net-applicationsettingsbase-should-i-call-upgrade-every-time-i-load
                    Settings.Default.Upgrade();
                    Settings.Default.Reload();
                    Settings.Default.NeedUpgrade = false;
                    Settings.Default.Save();
                    StartUpWithFirstOrNewVersionBehavior = true;
                }

#if DEBUG
                using (new Analytics("sje2fq26wnnk8c2kzflf", RegistrationDialog.GetAnalyticsUserInfo(), true))
#else
                string feedbackSetting = System.Environment.GetEnvironmentVariable("FEEDBACK");

                //default is to allow tracking
                var allowTracking = string.IsNullOrEmpty(feedbackSetting) || feedbackSetting.ToLower() == "yes" || feedbackSetting.ToLower() == "true";

                using (new Analytics("c8ndqrrl7f0twbf2s6cv", RegistrationDialog.GetAnalyticsUserInfo(), allowTracking))
#endif
                {
                    if (args.Length == 1 && args[0].ToLower().EndsWith(".bloompack"))
                    {
                        using (var dlg = new BloomPackInstallDialog(args[0]))
                        {
                            dlg.ShowDialog();
                        }
                        return;
                    }


#if !DEBUG //the exception you get when there is no other BLOOM is a pain when running debugger with break-on-exceptions
                    if (!GrabMutexForBloom())
                    {
                        return;
                    }
#endif

                    OldVersionCheck();



                    SetUpErrorHandling();

                    _applicationContainer = new ApplicationContainer();

                    SetUpLocalization();
                    Logger.Init();



                    if (args.Length == 1 && args[0].ToLower().EndsWith(".bloomcollection"))
                    {
                        Settings.Default.MruProjects.AddNewPath(args[0]);
                    }
                    _earliestWeShouldCloseTheSplashScreen = DateTime.Now.AddSeconds(3);

                    Settings.Default.Save();


                    Browser.SetUpXulRunner();

                    Application.Idle += Startup;



                    L10NSharp.LocalizationManager.SetUILanguage(Settings.Default.UserInterfaceLanguage, false);

                    try
                    {
                        Application.Run();
                    }
                    catch (System.AccessViolationException nasty)
                    {
                        Logger.ShowUserATextFileRelatedToCatastrophicError(nasty);
                        System.Environment.FailFast("AccessViolationException");
                    }

                    Settings.Default.Save();

                    Logger.ShutDown();


                    if (_projectContext != null)
                    {
                        _projectContext.Dispose();
                    }
                }
            }
            finally
            {
                ReleaseMutexForBloom();
            }
        }