protected void ButtonPreview_OnClick(Object sender, EventArgs e) { List <Client.Core.Work.WorkQueueItem> items; List <Server.Application.DataFilterDescriptor> filters = new List <Mercury.Server.Application.DataFilterDescriptor> (); if (!String.IsNullOrEmpty(PreviewWorkQueueSelection.SelectedValue)) { Server.Application.DataFilterDescriptor filter = new Mercury.Server.Application.DataFilterDescriptor(); filter.PropertyPath = "WorkQueueId"; filter.Operator = Mercury.Server.Application.DataFilterOperator.IsEqualTo; filter.Parameter = new Mercury.Server.Application.DataContract(); filter.Parameter.Name = "Value"; filter.Parameter.Value = PreviewWorkQueueSelection.SelectedValue; filters.Add(filter); } items = MercuryApplication.WorkQueueItemsGetByViewPage(workQueueView, filters, null, 1, 100, false); PreviewGrid.DataSource = items; PreviewGrid.DataBind(); return; }
private void setPreviewValues(bool?onoff) { if (onoff == false && PreviewCheckBox.IsChecked == false) { PreviewGrid.Items.Clear(); PreviewGrid.Height = 0; PreviewGrid.InvalidateArrange(); } else if (onoff == true || PreviewCheckBox.IsChecked == true) { PreviewGrid.Height = 100; setPreviewRowsInit(); PreviewGrid.InvalidateArrange(); } }
Rectangle GetPreviewWindowRect() { var parentWindow = VisualTreeHelperEx.FindAncestorByType <Window>(this); var relativePt = PreviewGrid.TranslatePoint(new System.Windows.Point(0, 0), parentWindow); var position = _reactor.Location.Value; var size = _reactor.Size.Value; var rect = new RectangleF((float)(relativePt.X + position.X), (float)(relativePt.Y + position.Y), (float)(size.Width), (float)(size.Height)); return(rect.ApplyDpi()); }
private void Properties_ValueChanged(object sender, RoutedEventArgs e) { try { if (DataContext is not ShadowViewModel model || PreviewViewBox.Width < 0) { return; } //Converts the direction in degrees to radians. var radians = Math.PI / 180.0 * model.Direction; var offsetX = model.Depth * Math.Cos(radians); var offsetY = model.Depth * Math.Sin(radians); //Each side can have a different offset based on the direction of the shadow. var offsetLeft = offsetX < 0 ? offsetX * -1 : 0; var offsetTop = offsetY > 0 ? offsetY : 0; var offsetRight = offsetX > 0 ? offsetX : 0; var offsetBottom = offsetY < 0 ? offsetY * -1 : 0; //Measure drop shadow space. var marginLeft = offsetLeft > 0 ? offsetLeft + model.BlurRadius / 2d : Math.Max(model.BlurRadius / 2d - offsetLeft, 0); //- offsetX var marginTop = offsetTop > 0 ? offsetTop + model.BlurRadius / 2d : Math.Max(model.BlurRadius / 2d - offsetTop, 0); //- offsetY var marginRight = offsetRight > 0 ? offsetRight + model.BlurRadius / 2d : Math.Max(model.BlurRadius / 2d + offsetRight, 0); //+ offsetX var marginBottom = offsetBottom > 0 ? offsetBottom + model.BlurRadius / 2d : Math.Max(model.BlurRadius / 2d + offsetBottom, 0); //+ offsetY PreviewGrid.Width = marginLeft + PreviewViewBox.Width + marginRight; PreviewGrid.Height = Math.Round(marginTop + PreviewViewBox.Height + marginBottom, 0); PreviewGrid.InvalidateVisual(); PreviewViewBox.InvalidateProperty(EffectProperty); //PreviewGrid.Width = left + totalWidth; //PreviewGrid.Height = top + totalHeight; //PreviewGrid.Margin = new Thickness(left, top, 0, 0); } catch (Exception ex) { LogWriter.Log(ex, "Error while trying to measure dropshadow size for the shadow task."); } }