예제 #1
0
        // OMG, http://www.roblox.com/Game/PlaceLauncher.ashx?request=RequestGame&placeId=1818

        private void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine("f");
            TaskDialog dialog = new TaskDialog();
            dialog.Opened += dialog_Opened;
            TaskDialogProgressBar bar = new TaskDialogProgressBar(0, 100, 2);
            bar.State = TaskDialogProgressBarState.Marquee;
            dialog.Controls.Add(bar);

            dialog.StandardButtons = TaskDialogStandardButtons.None;

            backgroundWorker1.RunWorkerCompleted += (s, ev) =>
            {
                if (ev.Result == (object)true)
                {
                    try
                    {
                        dialog.Close(TaskDialogResult.Ok);
                    }
                    catch { }
                }
            };

            dialog.InstructionText = "Launching Roblox...";
            dialog.Text = "Getting Authentication Url, Ticket, and Join Script.";
            dialog.Closing += dialog_Closing;
            dialog.Show();
        }
예제 #2
0
        // Here we walk our controls collection and
        // sort the various controls by type.
        private void SortDialogControls()
        {
            foreach (TaskDialogControl control in controls)
            {
                TaskDialogButtonBase  buttonBase  = control as TaskDialogButtonBase;
                TaskDialogCommandLink commandLink = control as TaskDialogCommandLink;

                if (buttonBase != null && string.IsNullOrEmpty(buttonBase.Text) &&
                    commandLink != null && string.IsNullOrEmpty(commandLink.Instruction))
                {
                    throw new InvalidOperationException(LocalizedMessages.TaskDialogButtonTextEmpty);
                }

                TaskDialogRadioButton radButton;
                TaskDialogProgressBar progBar;

                // Loop through child controls
                // and sort the controls based on type.
                if (commandLink != null)
                {
                    commandLinks.Add(commandLink);
                }
                else if ((radButton = control as TaskDialogRadioButton) != null)
                {
                    if (radioButtons == null)
                    {
                        radioButtons = new List <TaskDialogButtonBase>();
                    }
                    radioButtons.Add(radButton);
                }
                else if (buttonBase != null)
                {
                    if (buttons == null)
                    {
                        buttons = new List <TaskDialogButtonBase>();
                    }
                    buttons.Add(buttonBase);
                }
                else if ((progBar = control as TaskDialogProgressBar) != null)
                {
                    progressBar = progBar;
                }
                else
                {
                    throw new InvalidOperationException(LocalizedMessages.TaskDialogUnkownControl);
                }
            }
        }
예제 #3
0
        // Here we walk our controls collection and
        // sort the various controls by type.
        private void SortDialogControls()
        {
            foreach (TaskDialogControl control in controls)
            {
                if (control is TaskDialogButtonBase && String.IsNullOrEmpty(((TaskDialogButtonBase)control).Text))
                {
                    if (control is TaskDialogCommandLink && String.IsNullOrEmpty(((TaskDialogCommandLink)control).Instruction))
                    {
                        throw new InvalidOperationException(
                                  "Button text must be non-empty");
                    }
                }

                // Loop through child controls
                // and sort the controls based on type.
                if (control is TaskDialogCommandLink)
                {
                    commandLinks.Add((TaskDialogCommandLink)control);
                }
                else if (control is TaskDialogRadioButton)
                {
                    if (radioButtons == null)
                    {
                        radioButtons = new List <TaskDialogButtonBase>();
                    }
                    radioButtons.Add((TaskDialogRadioButton)control);
                }
                else if (control is TaskDialogButtonBase)
                {
                    if (buttons == null)
                    {
                        buttons = new List <TaskDialogButtonBase>();
                    }
                    buttons.Add((TaskDialogButtonBase)control);
                }
                else if (control is TaskDialogProgressBar)
                {
                    progressBar = (TaskDialogProgressBar)control;
                }
                else
                {
                    throw new ArgumentException("Unknown dialog control type.");
                }
            }
        }
예제 #4
0
        // Here we walk our controls collection and
        // sort the various controls by type.
        private void SortDialogControls()
        {
            foreach (TaskDialogControl control in controls)
            {
                if (control is TaskDialogButtonBase && String.IsNullOrEmpty(((TaskDialogButtonBase)control).Text))
                {
                    if (control is TaskDialogCommandLink && String.IsNullOrEmpty(((TaskDialogCommandLink)control).Instruction))
                        throw new InvalidOperationException(
                            "Button text must be non-empty");
                }

                // Loop through child controls
                // and sort the controls based on type.
                if (control is TaskDialogCommandLink)
                {
                    commandLinks.Add((TaskDialogCommandLink)control);
                }
                else if (control is TaskDialogRadioButton)
                {
                    if (radioButtons == null)
                        radioButtons = new List<TaskDialogButtonBase>();
                    radioButtons.Add((TaskDialogRadioButton)control);
                }
                else if (control is TaskDialogButtonBase)
                {
                    if (buttons == null)
                        buttons = new List<TaskDialogButtonBase>();
                    buttons.Add((TaskDialogButtonBase)control);
                }
                else if (control is TaskDialogProgressBar)
                {
                    progressBar = (TaskDialogProgressBar)control;
                }
                else
                {
                    throw new ArgumentException("Unknown dialog control type.");
                }
            }
        }
예제 #5
0
        // Cleans up data and structs from a single
        // native dialog Show() invocation.
        private void CleanUp()
        {
            // Reset values that would be considered
            // 'volatile' in a given instance.
            if (progressBar != null)
            {
                progressBar.Reset();
            }

            // Clean out sorted control lists -
            // though we don't of course clear the main controls collection,
            // so the controls are still around; we'll
            // resort on next show, since the collection may have changed.
            if (buttons != null)
                buttons.Clear();
            if (commandLinks != null)
                commandLinks.Clear();
            if (radioButtons != null)
                radioButtons.Clear();
            progressBar = null;

            // Have the native dialog clean up the rest.
            if (nativeDialog != null)
                nativeDialog.Dispose();
        }
예제 #6
0
        private static void buttonProgressEffects_Click(object sender, EventArgs e)
        {
            TaskDialog tdProgressEffectsSample = new TaskDialog();
            currentTaskDialog = tdProgressEffectsSample;
            tdProgressEffectsSample.Cancelable = true;
            tdProgressEffectsSample.Caption = "Progress Effects Sample";
            tdProgressEffectsSample.InstructionText = "Shows a dialog with Marquee style";

            TaskDialogProgressBar progressBarMarquee = new TaskDialogProgressBar();
            progressBarMarquee.State = TaskDialogProgressBarState.Marquee;

            tdProgressEffectsSample.ProgressBar = progressBarMarquee;

            tdProgressEffectsSample.Show();

            currentTaskDialog = null;
        }
예제 #7
0
        private static void buttonProgress_Click(object sender, EventArgs e)
        {
            TaskDialog tdProgressSample = new TaskDialog();
            currentTaskDialog = tdProgressSample;
            tdProgressSample.Cancelable = true;
            tdProgressSample.Caption = "Progress Sample";

            progressTDProgressBar = new TaskDialogProgressBar(0, MaxRange, 0);
            tdProgressSample.ProgressBar = progressTDProgressBar;

            tdProgressSample.Tick += new EventHandler<TaskDialogTickEventArgs>(tdProgressSample_Tick);

            tdProgressSample.Show();

            currentTaskDialog = null;
        }
예제 #8
0
        static void sendButton_Click(object sender, EventArgs e)
        {
            // Send feedback button
            TaskDialog tdSendFeedback = new TaskDialog();
            tdSendFeedback.Cancelable = true;

            tdSendFeedback.Caption = "Send Feedback Dialog";
            tdSendFeedback.Text = "Sending your feedback .....";

            // Show a progressbar
            sendFeedbackProgressBar = new TaskDialogProgressBar(0, MaxRange, 0);
            tdSendFeedback.ProgressBar = sendFeedbackProgressBar;

            // Subscribe to the tick event, so we can update the title/caption also close the dialog when done
            tdSendFeedback.Tick += new EventHandler<TaskDialogTickEventArgs>(tdSendFeedback_Tick);
            tdSendFeedback.Show();

            if (tdError != null)
                tdError.Close(TaskDialogResult.Ok);
        }
예제 #9
0
        // Here we walk our controls collection and
        // sort the various controls by type.
        private void SortDialogControls()
        {
            foreach (TaskDialogControl control in controls)
            {
                TaskDialogButtonBase buttonBase = control as TaskDialogButtonBase;
                TaskDialogCommandLink commandLink = control as TaskDialogCommandLink;

                if (buttonBase != null && string.IsNullOrEmpty(buttonBase.Text) &&
                    commandLink != null && string.IsNullOrEmpty(commandLink.Instruction))
                {
                    throw new InvalidOperationException(LocalizedMessages.TaskDialogButtonTextEmpty);
                }

                TaskDialogRadioButton radButton;
                TaskDialogProgressBar progBar;

                // Loop through child controls
                // and sort the controls based on type.
                if (commandLink != null)
                {
                    commandLinks.Add(commandLink);
                }
                else if ((radButton = control as TaskDialogRadioButton) != null)
                {
                    if (radioButtons == null) { radioButtons = new List<TaskDialogButtonBase>(); }
                    radioButtons.Add(radButton);
                }
                else if (buttonBase != null)
                {
                    if (buttons == null) { buttons = new List<TaskDialogButtonBase>(); }
                    buttons.Add(buttonBase);
                }
                else if ((progBar = control as TaskDialogProgressBar) != null)
                {
                    progressBar = progBar;
                }
                else
                {
                    throw new InvalidOperationException(LocalizedMessages.TaskDialogUnkownControl);
                }
            }
        }