コード例 #1
0
ファイル: Homepage.cs プロジェクト: KIV-ASWI-PL2014/Director
        /// <summary>
        /// Create components
        /// </summary>
        public override void _initializeComponents()
        {
            var markdown = new MarkdownView()
            {
                Markdown = MarkDownText
            };
            markdown.Margin = 10;

            var scrolled = new ScrollView(markdown)
            {
                MinHeight = 400
            };
            PackStart(scrolled, true);
        }
コード例 #2
0
ファイル: Markdown.cs プロジェクト: JohnACarruthers/xwt
        public MarkDownSample()
        {
            var openFileDialog = new OpenFileDialog ("Select File");
            var markdown = new MarkdownView() {
                Markdown = MarkDownText
            };
            var scrolled = new ScrollView (markdown) {
                MinHeight = 400
            };

            var button = new Button ("Open File");
            button.Clicked += delegate {
                if (openFileDialog.Run (ParentWindow)) {
                    markdown.Markdown = File.ReadAllText (openFileDialog.FileName);
                }
            };

            PackStart (button, BoxMode.FillAndExpand);
            PackStart (scrolled, BoxMode.FillAndExpand);
        }
コード例 #3
0
ファイル: LogViewerHelpDialog.cs プロジェクト: rte-se/emul8
        public LogViewerHelpDialog()
        {
            var label = new Label("Log viewer help");
            label.Font = label.Font.WithSize(15).WithWeight(Xwt.Drawing.FontWeight.Bold);

            var markdown = new MarkdownView();
            using(var stream = typeof(LogViewerHelpDialog).Assembly.GetManifestResourceStream("Emul8.Extensions.AdvancedLoggerViewer.LogViewerHelpFile.txt"))
            {
                using(var reader = new StreamReader(stream))
                {
                    markdown.Markdown = reader.ReadToEnd();
                }
            }

            var box = new VBox();
            box.PackStart(label);
            box.PackStart(markdown, true);

            Content = box;
            Buttons.Add(new DialogButton(Command.Ok));

            Width = 1000;
            Height = 300;
        }
コード例 #4
0
ファイル: CardView.cs プロジェクト: pleonex/deblocus
        private Widget CreateDescriptionView()
        {
            var virtualBox = new VBox();

            lblDescription = new MarkdownView {
                Markdown = Card.Description ?? "",
                Font = Font.WithSize(14),
                Visible = false
            };
            virtualBox.PackStart(lblDescription, true);

            txtDescription = new TextArea {
                Text = Card.Description ?? "",
                Font = Font.WithSize(14),
                Visible = false
            };
            virtualBox.PackStart(txtDescription, true);

            var scrollView = new ScrollView(virtualBox);
            scrollView.WidthRequest = 600;
            return scrollView;
        }
コード例 #5
0
ファイル: CrashHandler.cs プロジェクト: rte-se/emul8
        public static void HandleCrash(Exception e)
        {
            var path = TemporaryFilesManager.Instance.EmulatorTemporaryPath + TemporaryFilesManager.CrashSuffix;
            Directory.CreateDirectory(path);
            var filename = CustomDateTime.Now.ToString("yyyyMMddHHmmssfff");
            var ex = e;
            using(var file = File.CreateText(Path.Combine(path, filename)))
            {
                while(ex != null)
                {
                    file.WriteLine(ex.Message);
                    file.WriteLine(ex.StackTrace);
                    ex = ex.InnerException;
                    if(ex != null)
                    {
                        file.WriteLine("Inner exception:");
                    }
                }
            }

            ex = e;
            var dialog = new Dialog();
            dialog.Title = "Fatal error";
            var sb = new StringBuilder();
            while(ex != null)
            {
                sb.AppendLine(ex.Message);
                #if DEBUG
                sb.AppendLine(ex.StackTrace);
                #endif
                ex = ex.InnerException;
                if(ex != null)
                {
                    sb.AppendLine("Inner exception:");
                }
            }

            var markdown = new MarkdownView();
            markdown.Markdown = sb.ToString().Split(new [] { '\n' }).Select(x => "\t" + x).Aggregate((x, y) => x + "\n" + y);

            var copyButton = new Button("Copy to clipboard");
            copyButton.Clicked += (sender, ev) => Clipboard.SetText(sb.ToString());

            var box = new VBox();

            box.PackStart(new Label( String.Format("Got unhandled exception: `{0}`", e.GetType()) ) { Font = global::Xwt.Drawing.Font.SystemFont.WithSize(15).WithWeight(Xwt.Drawing.FontWeight.Bold) });
            box.PackStart(new ScrollView(markdown), true, true);
            box.PackStart(copyButton);

            dialog.Content = box;

            dialog.Buttons.Add(new DialogButton(Command.Ok));
            dialog.Width = 350;
            dialog.Height = 300;

            var mre = new ManualResetEvent(false);
            Console.WriteLine(sb);

            ApplicationExtensions.InvokeInUIThread(() => {
                dialog.Run();
                dialog.Dispose();

                mre.Set();
            });

            mre.WaitOne();

            Environment.Exit(-1);
        }
コード例 #6
0
ファイル: SetWindow.cs プロジェクト: KIV-ASWI-PL2014/Director
        /// <summary>
        /// Create set window.
        /// </summary>
        public SetWindow(RequestWidget _reqW, ResponseWidget _resP)
        {
            // Set
            ReqWidget = _reqW;
            ResWidget = _resP;

            // Set default size
            Width = 450;
            Height = 500;

            // This window can not be maximalized
            Resizable = true;

            // Icon
            Icon = Image.FromResource(DirectorImages.EDIT_ICON);

            // Set content
            Title = Director.Properties.Resources.SetContentTitle;

            // Center screen
            InitialLocation = WindowLocation.CenterScreen;

            // Create input area
            VBox InputArea = new VBox();

            // Prepare input
            TextInput = new TextEntry()
            {
                ExpandVertical = true,
                ExpandHorizontal = true,
                MultiLine = true
            };

            TextInput.Text = "";

            // Content type combo box
            ContentTypeSelect = new ComboBox ();
            ContentTypeSelect.Items.Add (ContentType.JSON, "JSON");
            ContentTypeSelect.Items.Add (ContentType.XML, "XML");
            ContentTypeSelect.Items.Add (ContentType.PLAIN, "PLAIN");
            ContentTypeSelect.SelectedIndex = 0;

            if (ReqWidget != null)
            {
                if (ReqWidget.ActiveRequest.RequestTemplateType == ContentType.JSON) {
                    TextInput.Text = JSONFormatter.Format (ReqWidget.ActiveRequest.RequestTemplate);
                }
                if (TextInput.Text.Length == 0) {
                    TextInput.Text = ReqWidget.ActiveRequest.RequestTemplate;
                }
                ContentTypeSelect.SelectedItem = ReqWidget.ActiveRequest.RequestTemplateType;
            }
            else if (ResWidget != null)
            {
                if (ResWidget.ActiveRequest.ResponseTemplateType == ContentType.JSON) {
                    TextInput.Text = JSONFormatter.Format (ResWidget.ActiveRequest.ResponseTemplate);
                }
                if (TextInput.Text.Length == 0) {
                    TextInput.Text = ResWidget.ActiveRequest.ResponseTemplate;
                }
                ContentTypeSelect.SelectedItem = ResWidget.ActiveRequest.ResponseTemplateType;
            }

            // Add
            InputArea.PackStart(new Label() { Markup = "<b>Content type:</b>" });
            InputArea.PackStart (ContentTypeSelect, false, true);

            ScrollView ScrollTextInput = new ScrollView()
            {
                Content = TextInput
            };
            InputArea.PackStart(new Label() { Markup = "<b>" + Director.Properties.Resources.PasteInput + "</b>" });
            InputArea.PackStart(ScrollTextInput, true, true);

            // Prepare output
            InputArea.PackStart(new Label() { Markup = "<b>" + Director.Properties.Resources.Output + "</b>" });
            ErrorReport = new MarkdownView();
            InputArea.PackStart(ErrorReport, true, true);

            // Btn
            Button ConfirmButton = new Button(Image.FromResource(DirectorImages.OK_ICON),
                Director.Properties.Resources.ConfirmInput)
            {
                WidthRequest = 150,
                ExpandHorizontal = false,
                ExpandVertical = false
            };
            InputArea.PackStart(ConfirmButton, expand: false, hpos: WidgetPlacement.End);

            // Save
            ConfirmButton.Clicked += ConfirmButton_Clicked;

            // Content is input area
            Content = InputArea;
        }