void OnClick_CopyImage(object sender, RoutedEventArgs args) { Mouse.OverrideCursor = Cursors.Wait; try { ViewMaker vo = vstuff.CloneSettings(); vo.vp = null; vo.bAnimate = false; vo.width = 1600; vo.height = 1200; vo.bCloneTran = true; vo.bAutoZoom = true; BitmapSource bmp = vo.MakeBitmap(GetCurrentStep()); #if false Rect bb = sdwpf.Get2DBoundingBox(vo.vp); Int32Rect ir = new Int32Rect((int)bb.X, (int)bb.Y, (int)bb.Width, (int)bb.Height); CroppedBitmap cb = new CroppedBitmap(bmp, ir); Clipboard.SetImage(cb); #else Clipboard.SetImage(bmp); #endif } finally { Mouse.OverrideCursor = null; } }
// Set up AboutPage UI private void PageLayout() { Title = viewModel.Title; // Gird Grid grid = LayoutMaker.NewGrid(2, 0); grid.RowDefinitions[0].Height = GridLength.Auto; grid.RowDefinitions[1].Height = GridLength.Star; // Grid StackLayout StackLayout stackLayout = LayoutMaker.NewStackLayout(new Thickness(0, 0, 0, 0)); stackLayout.BackgroundColor = Color.FromHex(VariablesGlobal.COLOUR_ACCENT); stackLayout.VerticalOptions = LayoutOptions.FillAndExpand; stackLayout.HorizontalOptions = LayoutOptions.Fill; ContentView contentView = ViewMaker.NewContentView(new Thickness(0, 40, 0, 40), ViewMaker.NewImageByHeight(VariablesGlobal.IMAGE_XAMARIN_LOGO, LayoutOptions.Center, 64)); contentView.VerticalOptions = LayoutOptions.FillAndExpand; stackLayout.Children.Add(contentView); // ScrollView StackLayout StackLayout contentStackLayout = LayoutMaker.NewStackLayout(new Thickness(16, 40, 16, 40), 10); contentStackLayout.Orientation = StackOrientation.Vertical; contentStackLayout.Children.Add(AppDetailsLabel()); contentStackLayout.Children.Add(AppInformationLabel()); contentStackLayout.Children.Add(AppTextLabel()); contentStackLayout.Children.Add(ViewMaker.NewButtonICommand(viewModel.OpenWebCommand, VariablesTexts.BUTTON_LEARN_MORE)); // Add content to grid grid.Children.Add(stackLayout, 0, 0); grid.Children.Add(LayoutMaker.NewScrollView(contentStackLayout), 0, 1); Content = grid; }
// Set up ItemsPage UI private void PageLayout() { StackLayout stackLayoutView = LayoutMaker.NewStackLayout(new Thickness(0, 0, 0, 0)); foreach (Item item in viewModel.GetItems()) { Button button = new Button() { Text = VariablesTexts.BUTTON_NAME_VIEW, Command = new Command(() => { Navigation.PushAsync(new ItemDetailPage(new ItemDetailViewModel(item))); }), }; StackLayout stackLayout = LayoutMaker.NewStackLayout(new Thickness(0, 0, 0, 0)); stackLayout.Children.Add(ViewMaker.NewLabelString(VariablesTexts.LABEL_ITEM_NAME)); stackLayout.Children.Add(ViewMaker.NewLabelString(item.Name)); stackLayout.Children.Add(ViewMaker.NewLabelString(VariablesTexts.LABEL_ITEM_TEXT)); stackLayout.Children.Add(ViewMaker.NewLabelString(item.Text)); stackLayout.Children.Add(button); stackLayoutView.Children.Add(stackLayout); } Content = LayoutMaker.NewScrollView(stackLayoutView); }
/// <summary> /// Show the ExceptionReport dialog /// </summary> /// <remarks>The <see cref="ExceptionReporter"/> will analyze the <see cref="Exception"/>s and /// create and show the report dialog.</remarks> /// <param name="exceptions">The <see cref="Exception"/>s to show.</param> public bool Show(params Exception[] exceptions) { // silently ignore the mistake of passing null if (exceptions == null || exceptions.Length == 0 || exceptions.Length >= 1 && exceptions[0] == null) { return(false); } bool status; try { _info.SetExceptions(exceptions); var view = ViewMaker.Create(); view.ShowWindow(); status = true; } catch (Exception ex) { status = false; ViewMaker.ShowError(ex.Message, "Failed trying to report an Error"); } return(status); }
public static HTMLElement MakeView <ValueType>( this ValueType value, object Data = null) { if (ViewMaker <ValueType> .MakeView == null) { throw new NotImplementedException("Make View not declared For " + typeof(ValueType).FullName); } return(ViewMaker <ValueType> .MakeView(value, Data)); }
private Label AppDetailsLabel() { FormattedString appDetailsStrings = ElementMaker.NewFormattedString(3); Label appDetails = ViewMaker.NewLabelFormattedString(appDetailsStrings, VariablesGlobal.TEXT_SIZE_LARGE); appDetailsStrings.Spans[0] = ElementMaker.NewSpan(VariablesTexts.APPLICATION_NAME, VariablesGlobal.TEXT_SIZE_LARGE, FontAttributes.Bold); appDetailsStrings.Spans[1] = ElementMaker.NewSpan(VariablesTexts.TEXT_SPACE); appDetailsStrings.Spans[2] = ElementMaker.NewSpan(VariablesTexts.APPLICATION_VERSION, VariablesGlobal.TEXT_SIZE_MEDIUM, FontAttributes.None, VariablesGlobal.COLOUR_TEXT_LIGHT); appDetailsStrings.Spans[2].ForegroundColor = Color.FromHex(VariablesGlobal.COLOUR_TEXT_LIGHT); return(appDetails); }
private void FixLines() { #if true wpfmisc.FixLines(vstuff.vp); ListViewItem lvi = mySteps.SelectedItem as ListViewItem; if (lvi != null) { StackPanel sp = lvi.Content as StackPanel; ViewMaker vo = sp.Tag as ViewMaker; wpfmisc.FixLines(vo.vp); } #endif }
// Set up ItemDetailPage UI private void PageLayout(ItemDetailViewModel viewModel) { Title = viewModel.Title; StackLayout stackLayout = LayoutMaker.NewStackLayout(new Thickness(0, 0, 0, 0)); stackLayout.Children.Add(ViewMaker.NewLabelString(VariablesTexts.LABEL_ITEM_NAME, VariablesGlobal.TEXT_SIZE_LARGE)); stackLayout.Children.Add(ViewMaker.NewLabelString(viewModel.Item.Text)); stackLayout.Children.Add(ViewMaker.NewLabelString(VariablesTexts.LABEL_ITEM_TEXT, VariablesGlobal.TEXT_SIZE_LARGE)); stackLayout.Children.Add(ViewMaker.NewLabelString(viewModel.Item.Name)); Content = stackLayout; }
private Label AppTextLabel() { FormattedString appDetailsStrings = ElementMaker.NewFormattedString(4); Label appDetails = ViewMaker.NewLabelFormattedString(appDetailsStrings, VariablesGlobal.TEXT_SIZE_MEDIUM); appDetailsStrings.Spans[0] = ElementMaker.NewSpan(VariablesTexts.ABOUT_CONTENT_INFO_3_4); appDetailsStrings.Spans[1] = ElementMaker.NewSpan(VariablesTexts.TEXT_SPACE); appDetailsStrings.Spans[2] = ElementMaker.NewSpan(VariablesTexts.ABOUT_CONTENT_INFO_4_4, VariablesGlobal.TEXT_SIZE_LARGE, FontAttributes.Bold); appDetailsStrings.Spans[2].ForegroundColor = Color.FromHex(VariablesGlobal.COLOUR_TEXT_LIGHT); appDetailsStrings.Spans[3] = ElementMaker.NewSpan(VariablesTexts.TEXT_PERIOD); return(appDetails); }
// Set up NewItemPage UI layout private void PageLayout() { Title = VariablesTexts.TOOLBAR_NAME_ADD; StackLayout stackLayout = LayoutMaker.NewStackLayout(new Thickness(0, 0, 0, 0)); entryName = InputViewMaker.NewEntry(); editorText = InputViewMaker.NewEditor(); stackLayout.Children.Add(ViewMaker.NewLabelString(VariablesTexts.LABEL_ITEM_NAME, VariablesGlobal.TEXT_SIZE_LARGE)); stackLayout.Children.Add(entryName); stackLayout.Children.Add(ViewMaker.NewLabelString(VariablesTexts.LABEL_ITEM_TEXT, VariablesGlobal.TEXT_SIZE_LARGE)); stackLayout.Children.Add(editorText); ToolbarItems.Add(MenuItemMaker.NewToolbarItem(Save_Clicked, VariablesTexts.TOOLBAR_NAME_SAVE)); Content = stackLayout; }
public object MakeListViewPicture(Step st) { ViewMaker vo = new ViewMaker(); vo.bShowHighlights = true; vo.bShowLines = true; vo.bShowEndGrain = true; vo.bShowFaceLabels = false; vo.bShowAnnotations = false; vo.bAnimate = false; vo.bAutoZoom = st.bDefaultZoom; vo.width = 200; vo.height = 120; vo.MakeView(st); vo.vp.HorizontalAlignment = HorizontalAlignment.Left; Label lab = new Label(); lab.Content = st.Description; if (st.Errors.Count > 0) { lab.Foreground = Brushes.Red; lab.ToolTip = st.Errors[0]; } else if (st.Warnings.Count > 0) { lab.Foreground = Brushes.Yellow; lab.ToolTip = st.Warnings[0]; } else { } StackPanel sp = new StackPanel(); sp.Tag = vo; sp.Children.Add(lab); sp.Children.Add(vo.vp); return(sp); }
void OnClick_CopyXAML(object sender, RoutedEventArgs args) { Mouse.OverrideCursor = Cursors.Wait; try { ViewMaker vo = vstuff.CloneSettings(); vo.vp = null; vo.bAnimate = false; vo.bStaticLines = true; vo.width = 1600; vo.height = 1200; vo.MakeView(GetCurrentStep()); StringBuilder sb = new StringBuilder(); TextWriter tw = new StringWriter(sb); XmlTextWriter xw = new XmlTextWriter(tw); xw.Formatting = Formatting.Indented; XamlWriter.Save(vo.vp, xw); xw.Close(); string xaml = sb.ToString(); // string x2 = XamlWriter.Save(vo.vp); xaml = xaml.Replace(string.Format("<Viewport3D Height=\"{0}\" Width=\"{1}\" ", vo.height, vo.width), "<Viewport3D "); Clipboard.SetText(xaml); //Clipboard.SetText(XamlWriter.Save(vo.vp)); } finally { Mouse.OverrideCursor = null; } }