Ejemplo n.º 1
0
        public override void Execute()
        {
            var files = import.ShowImportImageDialog();

            if (files == null)
            {
                return;
            }

            // nothing imported yet => show in same window
            if (models.Images.NumImages == 0)
            {
                foreach (var file in files)
                {
                    import.ImportImage(file);
                }
                return;
            }

            // already images imported => show in new window
            var args = "";

            foreach (var file in files)
            {
                args += $"\"{file}\" ";
            }

            var info = new System.Diagnostics.ProcessStartInfo(models.Window.AssemblyPath, args);

            System.Diagnostics.Process.Start(info);
        }
Ejemplo n.º 2
0
        public override void Execute()
        {
            var files = importDialog.ShowImportImageDialog();

            if (files == null)
            {
                return;
            }

            foreach (var file in files)
            {
                importDialog.ImportImage(file);
            }
        }
Ejemplo n.º 3
0
        public void Drop(IDropInfo dropInfo)
        {
            if (dropInfo.Data is ImageListBoxItem)
            {
                // move images
                var idx1 = ImageListItems.IndexOf(dropInfo.Data as ImageListBoxItem);
                var idx2 = dropInfo.InsertIndex;
                if (idx1 < 0 || idx2 < 0)
                {
                    return;
                }
                // did the order change?
                if (idx1 == idx2)
                {
                    return;
                }

                // move image want the final position of the moved image
                if (idx1 < idx2)
                {
                    idx2--;
                }

                // put item from idx1 into the position it was dragged to
                models.Images.MoveImage(idx1, idx2);
            }
            else if (dropInfo.Data is DataObject)
            {
                var obj   = dropInfo.Data as System.Windows.DataObject;
                var items = obj.GetFileDropList();
                if (items == null)
                {
                    return;
                }

                int desiredPosition = dropInfo.InsertIndex;

                foreach (var file in items)
                {
                    import.ImportImage(file);

                    // put inserted image into correct position
                    models.Images.MoveImage(models.Images.NumImages - 1, desiredPosition++);
                }
            }
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                models    = new ModelsEx(this);
                ViewModel = new ViewModels.ViewModels(models);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
                return;
            }

            DataContext = ViewModel;
            Width       = models.Settings.WindowWidth;
            Height      = models.Settings.WindowHeight;
            if (models.Settings.IsMaximized)
            {
                WindowState = WindowState.Maximized;
            }

            // handle startup arguments
            if (App.StartupArgs.Length == 0)
            {
                return;
            }

            var import = new ImportDialogController(models);

            foreach (var arg in App.StartupArgs)
            {
                import.ImportImage(arg);
            }
        }