Exemple #1
0
        public static void ItemGroupCopyEntries(List <ReadableTuple <int> > items, BaseDb gdb, TabControl control, ServerType serverType)
        {
            var parent = WpfUtilities.FindDirectParentControl <SdeEditor>(control);

            parent.AsyncOperation.SetAndRunOperation(new GrfThread(delegate {
                items = items.OrderBy(p => p.GetKey <int>()).ToList();

                StringBuilder builder = new StringBuilder();

                try {
                    AProgress.Init(parent);
                    DbLoaderErrorHandler.Start();

                    var dbItems = gdb.GetMeta <int>(ServerDbs.Items);

                    List <string> aegisNames = dbItems.FastItems.Select(p => p.GetStringValue(ServerItemAttributes.AegisName.Index)).ToList();
                    List <string> names      = dbItems.FastItems.Select(p => p.GetStringValue(ServerItemAttributes.Name.Index)).ToList();

                    for (int i = 0; i < items.Count; i++)
                    {
                        AProgress.IsCancelling(parent);
                        DbWriterMethods.DbItemGroupWriter2(items[i], serverType, builder, gdb, aegisNames, names);
                        parent.Progress = (i + 1f) / items.Count * 100f;
                    }
                }
                catch (OperationCanceledException) { }
                finally {
                    AProgress.Finalize(parent);
                    DbLoaderErrorHandler.Stop();
                }

                Clipboard.SetText(builder.ToString());
            }, parent, 200, null, true, true));
        }
Exemple #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType != typeof(double))
            {
                return(null);
            }
            if (!(value is Border))
            {
                return(0);
            }

            Border text = (Border)value;

            TextViewItem res = WpfUtilities.FindDirectParentControl <TextViewItem>(text);

            if (res == null)
            {
                return(text.ActualWidth);
            }

            ListView view = res.ListView;

            if (view == null)
            {
                return(text.ActualWidth);
            }

            if (view.ActualWidth < 0)
            {
                return(0);
            }

            double dParentWidth   = view.ActualWidth;
            double dToAdjust      = parameter == null ? 0 : double.Parse(parameter.ToString());
            double dAdjustedWidth = dParentWidth + dToAdjust - 10;

            if (_isScrollBarVisible(view))
            {
                dAdjustedWidth -= SystemParameters.VerticalScrollBarWidth;
            }

            return(dAdjustedWidth < 0 ? 0 : dAdjustedWidth);
        }
 private void _buttonSettings_Click(object sender, RoutedEventArgs e)
 {
     WindowProvider.Show(new PreviewSettingsDialog(() => OnFrameChanged(SelectedFrame), c => _viewer._primary.Background = new SolidColorBrush(c)), _buttonSettings, WpfUtilities.FindDirectParentControl <Window>(this));
 }