public void ShowPopup <T> (params object [] args) where T : IProcessor
        {
            try
            {
                T processor = Activator.CreateInstance <T> ();
                subWindow = (processor is BatchProcessor)
                                        ? new SubWindow_Batch(false) as ISubWindow
                                        : new SubWindow(processor, false);
                var windowControl = subWindow as System.Windows.Controls.UserControl;
                windowControl.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                subWindow.OKButtonClicked     += SubWindow_OKButtonClicked;
                subWindow.CancelButtonClicked += SubWindow_CancelButtonClicked;

                window = new Form()
                {
                    ClientSize      = new System.Drawing.Size(( int )windowControl.DesiredSize.Width, ( int )windowControl.DesiredSize.Height),
                    StartPosition   = FormStartPosition.CenterParent,
                    SizeGripStyle   = SizeGripStyle.Hide,
                    FormBorderStyle = FormBorderStyle.FixedSingle,
                    Font            = System.Drawing.SystemFonts.DefaultFont,
                    MaximizeBox     = false,
                    MinimizeBox     = false,
                    ShowIcon        = false,
                };
                ElementHost host = new ElementHost()
                {
                    Child = subWindow as UIElement
                };
                host.Dock   = DockStyle.Fill;
                window.Dock = DockStyle.Fill;
                window.Controls.Add(host);

                window.Show();
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show($"알 수 없는 오류가 발생했습니다.\n{ex}",
                                               "오류", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #2
0
        public void ShowPopup <T> (params object [] args) where T : IProcessor
        {
            T processor = Activator.CreateInstance <T> ();

            if (processor is ManualEditProcessor)
            {
                (processor as ManualEditProcessor).ChangeName         = (args [0] as FileInfo).ChangedFilename;
                (processor as ManualEditProcessor).ChangePath         = (args [0] as FileInfo).ChangedPath;
                (processor as ManualEditProcessor).ProcessingFileInfo = args [0] as FileInfo;
            }
            ISubWindow window = (processor is BatchProcessor)
                                ? new SubWindow_Batch() as ISubWindow
                                : new SubWindow(processor);
            UserControl windowControl = window as UserControl;

            window.OKButtonClicked           += SubWindow_OKButtonClicked;
            window.CancelButtonClicked       += SubWindow_CancelButtonClicked;
            windowControl.VerticalAlignment   = VerticalAlignment.Center;
            windowControl.HorizontalAlignment = HorizontalAlignment.Center;
            overlayWindowContainer.Children.Add(windowControl);
            overlayWindowGrid.Visibility = Visibility.Visible;
        }
        public void ClosePopup(bool apply = false)
        {
            try
            {
                if (apply)
                {
                    var processor = subWindow.Processor;
                    InitializeFileList();
                    if (!processor.CannotMultithreadProcess)
                    {
                        Parallel.ForEach <FileInfo> (FileInfo.Files, (fileInfo) => processor.Process(fileInfo));
                    }
                    else
                    {
                        foreach (var fileInfo in FileInfo.Files)
                        {
                            processor.Process(fileInfo);
                        }
                    }

                    Daramee.Winston.File.Operation.Begin(true);
                    Parallel.ForEach(FileInfo.Files, (fileInfo) => {
                        if (!fileInfo.Move(false, out ErrorCode errorCode))
                        {
                        }
                    });
                    Daramee.Winston.File.Operation.End();
                }
                window.Close();
                window.Dispose();
                window    = null;
                subWindow = null;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show($"알 수 없는 오류가 발생했습니다.\n{ex}",
                                               "오류", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #4
0
 public SubWindowClosure(MenuItem menuitem, ISubWindow isubwindow)
 {
     _menuitem = menuitem;
     _isubwindow = isubwindow;
 }
예제 #5
0
 public SubWindowClosure(MenuItem menuitem, ISubWindow isubwindow)
 {
     _menuitem   = menuitem;
     _isubwindow = isubwindow;
 }