public override ComponentFactory CreateComponent(Components comp, int height, int width, int leftMargin, int topMargin, string content)
        {
            HTMLComponentFactory c = new HTMLComponentFactory();

            switch (comp)
            {
            case Components.TextArea:
                c = new HTMLTextArea(height, width, leftMargin, topMargin, content);
                break;

            case Components.TextBox:
                c = new HTMLTextBox(height, width, leftMargin, topMargin, content);
                break;

            case Components.Label:
                c = new HTMLLabel(height, width, leftMargin, topMargin, content);
                break;

            case Components.Button:
                c = new HTMLButton(height, width, leftMargin, topMargin, content);
                break;

            default:
                break;
            }
            return(c);
        }
Ejemplo n.º 2
0
 public EndMenu(string[] lines, string filename)
 {
     this.DescriptionBox = new HTMLTextBox(lines);
     for (int a1 = 0; a1 < this.DescriptionBox.Menu.ImagePaths.Count; ++a1)
     {
         this.DescriptionBox.Menu.ImagePaths[a1] = Path.Combine(filename, this.DescriptionBox.Menu.ImagePaths[a1]);
     }
     this.CustomInitializer();
 }
Ejemplo n.º 3
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            share = e.Parameter as ShareOperation;

            await Task.Factory.StartNew(async() =>
            {
                title       = share.Data.Properties.Title;
                description = share.Data.Properties.Description;
                thumbImage  = share.Data.Properties.Thumbnail;

                //IF THERE WAS FORMATTED TEXT SHARED
                if (share.Data.Contains(StandardDataFormats.Html))
                {
                    formattedText = await share.Data.GetHtmlFormatAsync();
                }
                //IF THERE WAS A URI SHARED
                if (share.Data.Contains(StandardDataFormats.Uri))
                {
                    uri = await share.Data.GetUriAsync();
                }
                //IF THERE WAS UNFORMATTED TEXT SHARED
                if (share.Data.Contains(StandardDataFormats.Text))
                {
                    text = await share.Data.GetTextAsync();
                }
                //IF THERE WERE FILES SHARED
                if (share.Data.Contains(StandardDataFormats.StorageItems))
                {
                    storageItems = await share.Data.GetStorageItemsAsync();
                }
                //IF THERE WAS CUSTOM DATA SHARED
                if (share.Data.Contains(customDataFormat))
                {
                    customData = await share.Data.GetTextAsync(customDataFormat);
                }
                //IF THERE WERE IMAGES SHARED.
                if (share.Data.Contains(StandardDataFormats.Bitmap))
                {
                    bitmapImage = await share.Data.GetBitmapAsync();
                }

                //MOVING BACK TO THE UI THREAD, THIS IS WHERE WE POPULATE OUR INTERFACE.
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    TitleBox.Text       = title;
                    DescriptionBox.Text = description;

                    if (text != null)
                    {
                        UnformattedTextBox.Text = text;
                    }
                    if (uri != null)
                    {
                        UriButton.Content     = uri.ToString();
                        UriButton.NavigateUri = uri;
                    }

                    if (formattedText != null)
                    {
                        HTMLTextBox.NavigateToString(HtmlFormatHelper.GetStaticFragment(formattedText));
                    }

                    if (bitmapImage != null)
                    {
                        IRandomAccessStreamWithContentType bitmapStream = await this.bitmapImage.OpenReadAsync();
                        BitmapImage bi = new BitmapImage();
                        bi.SetSource(bitmapStream);
                        WholeImage.Source = bi;

                        bitmapStream = await this.thumbImage.OpenReadAsync();
                        bi           = new BitmapImage();
                        bi.SetSource(bitmapStream);
                        ThumbImage.Source = bi;
                    }

                    if (customData != null)
                    {
                        StringBuilder receivedStrings = new StringBuilder();
                        JsonObject customObject       = JsonObject.Parse(customData);
                        if (customObject.ContainsKey("type"))
                        {
                            if (customObject["type"].GetString() == "http://schema.org/Person")
                            {
                                receivedStrings.AppendLine("Type: " + customObject["type"].Stringify());
                                JsonObject properties = customObject["properties"].GetObject();
                                receivedStrings.AppendLine("Image: " + properties["image"].Stringify());
                                receivedStrings.AppendLine("Name: " + properties["name"].Stringify());
                                receivedStrings.AppendLine("Affiliation: " + properties["affiliation"].Stringify());
                                receivedStrings.AppendLine("Birth Date: " + properties["birthDate"].Stringify());
                                receivedStrings.AppendLine("Job Title: " + properties["jobTitle"].Stringify());
                                receivedStrings.AppendLine("Nationality: " + properties["Nationality"].Stringify());
                                receivedStrings.AppendLine("Gender: " + properties["gender"].Stringify());
                            }
                            CustomDataBox.Text = receivedStrings.ToString();
                        }
                    }
                });
            });
        }