コード例 #1
0
        public XmlProcessorData(string filepath, int index, Grid g)
        {
            Converter = new ConverterXmlToJson(filepath);
            int begin = filepath.LastIndexOf('\\');
            int end   = filepath.LastIndexOf(".xml");

            name = filepath.Substring(begin + 1, end - 1 - begin);
            float OffsX = 5;

            NameL                     = new TextView(OffsX, 5 + 35 * index, 70, 25, "Файл " + (index + 1), CustomStyles.TitleStyle);
            OffsX                    += 75;
            FileName                  = new TextView(OffsX, 5 + 35 * index, 225, 25, name, CustomStyles.TitleStyle);
            FileName.ToolTip          = name;
            FileName.TextWrapping     = System.Windows.TextWrapping.NoWrap;
            OffsX                    += 235;
            Progress                  = new TextView(OffsX, 5 + 35 * index, 80, 25, "Состояние");
            OffsX                    += 85;
            State                     = new TextBlock();
            State.Margin              = new System.Windows.Thickness(OffsX, 5 + 35 * index, 0, 0);
            State.Width               = 100;
            State.Height              = 25;
            State.Text                = "Ожидание";
            State.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            State.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
            State.TextAlignment       = System.Windows.TextAlignment.Center;
            State.FontSize            = 16;
            State.Background          = new SolidColorBrush(Color.FromArgb(255, 37, 38, 41));
            State.Foreground          = Brushes.White;
            OffsX                    += 105;
            Remove                    = new ImageButton(OffsX, 5 + 35 * index, 30, 25, ConverterStylesData.RemoveImg);
            Remove.Index              = index;
            OffsX                    += 35;
            OpenConverted             = new ImageButton(OffsX, 5 + 35 * index, 30, 25, ConverterStylesData.RedEye);
            OpenConverted.ToolTip     = "Просмотр доступен только после конвертации";
            OffsX                    += 35;
            OpenConverted.MouseUp    += OpenInBrowser;
            OpenConverted.IsEnabled   = false;

            g.Children.Add(NameL);
            g.Children.Add(FileName);
            g.Children.Add(Progress);
            g.Children.Add(State);

            Remove.AddToControl(g);
            OpenConverted.AddToControl(g);
        }
コード例 #2
0
 public void ClearConverter()
 {
     Converter = null;
     GC.Collect();
 }