Lagt till en initialbild
This commit is contained in:
@ -46,6 +46,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@ -1,14 +1,71 @@
|
||||
using Caliburn.Micro;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace ImageHandlingUI.ViewModels
|
||||
{
|
||||
public class ShellViewModel : Conductor<object>
|
||||
{
|
||||
|
||||
public ShellViewModel()
|
||||
{
|
||||
//using (var ms = new MemoryStream())
|
||||
//{
|
||||
// System.Drawing.Image.FromFile(@"D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG").Save(ms, ImageFormat.Bmp);
|
||||
// ms.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
// var bitmapImage = new BitmapImage();
|
||||
// bitmapImage.BeginInit();
|
||||
// bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||
// bitmapImage.StreamSource = ms;
|
||||
// bitmapImage.EndInit();
|
||||
|
||||
// _selectedImage = bitmapImage;
|
||||
//}
|
||||
|
||||
//_selectedImage = System.Drawing.Image.FromFile(@"D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG");
|
||||
|
||||
initialFileName = @"D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG";
|
||||
_selectedImage = ConvertFromDrawImage(System.Drawing.Image.FromFile(InitialFileName));
|
||||
}
|
||||
ImageSource _selectedImage = null;
|
||||
private string initialFileName;
|
||||
|
||||
public ImageSource SelectedImage
|
||||
{
|
||||
get { return _selectedImage; }
|
||||
set
|
||||
{
|
||||
_selectedImage = value;
|
||||
NotifyOfPropertyChange(() => SelectedImage);
|
||||
}
|
||||
}
|
||||
|
||||
public string InitialFileName { get => initialFileName; set => initialFileName = value; }
|
||||
|
||||
private static BitmapImage ConvertFromDrawImage(System.Drawing.Image _image)
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
//System.Drawing.Image.FromFile(@"D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG").Save(ms, ImageFormat.Bmp);
|
||||
_image.Save(ms, ImageFormat.Bmp);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
var bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bitmapImage.StreamSource = ms;
|
||||
bitmapImage.EndInit();
|
||||
|
||||
return bitmapImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,9 +4,124 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ImageHandlingUI.Views" FontSize="12"
|
||||
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
|
||||
Title="ShellView" Height="450" Width="800">
|
||||
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
|
||||
Title="ShellView" Height="650" Width="800" Background="Beige">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20" />
|
||||
<!--Border-->
|
||||
<ColumnDefinition Width="auto" />
|
||||
<!--Depending on control?-->
|
||||
<ColumnDefinition Width="auto" MinWidth="102" />
|
||||
<!--Depending on control?-->
|
||||
<ColumnDefinition Width="auto" MinWidth="248" />
|
||||
<!--Depending on control?-->
|
||||
<ColumnDefinition Width="auto" />
|
||||
<!--Depending on control?-->
|
||||
<ColumnDefinition />
|
||||
<!--Resten-->
|
||||
<ColumnDefinition Width="20" />
|
||||
<!--Border-->
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="20" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--Row 1-->
|
||||
<TextBlock Grid.Row="1" Grid.Column="3"
|
||||
HorizontalAlignment="Center" FontSize="18" Margin="119,0,1,0" Width="128">
|
||||
Picture handling
|
||||
</TextBlock>
|
||||
|
||||
<!--Row 2-->
|
||||
<TextBlock Grid.Row="2" Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Bottom" Height="16" Width="42" Margin="3 3 3 3">
|
||||
Filnamn
|
||||
</TextBlock>
|
||||
<TextBox x:Name="InitialFileName"
|
||||
Grid.Row="2" Grid.Column="2"
|
||||
Grid.ColumnSpan="4"
|
||||
Margin="3 3 3 3"/>
|
||||
|
||||
<!--Row 3-->
|
||||
<TextBlock Grid.Row="3" Grid.Column="1"
|
||||
HorizontalAlignment="Left" Width="23" Margin="3 3 3 3">
|
||||
Path
|
||||
</TextBlock>
|
||||
<TextBox x:Name="InitialFilePath" Grid.Row="3"
|
||||
Grid.Column="2" Grid.ColumnSpan="2"
|
||||
MinWidth="350" Margin="3,3"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="4" HorizontalAlignment="Left" Width="39" Margin="3 3 3 3">
|
||||
Skapad
|
||||
</TextBlock>
|
||||
<TextBox x:Name="CreatedDate" Grid.Row="3"
|
||||
Grid.Column="5"
|
||||
Margin="3 3 3 3"/>
|
||||
|
||||
<!--Row 4-->
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" Width="56" Margin="3 3 3 3">
|
||||
GrundPath
|
||||
</TextBlock>
|
||||
<TextBox x:Name="GroundPath" Grid.Row="4"
|
||||
Grid.Column="2" Grid.ColumnSpan="2"
|
||||
Margin="3,3,3,3" Height="16" VerticalAlignment="Top"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="4" HorizontalAlignment="Left" Width="44" Margin="3 3 3 3">
|
||||
Slutpath
|
||||
</TextBlock>
|
||||
<TextBox x:Name="FinishPath"
|
||||
Grid.Row="4" Grid.Column="5" Margin="3,3,3,3" Height="16" VerticalAlignment="Top"/>
|
||||
|
||||
<!--Row 5-->
|
||||
<Button x:Name="ChooseFile" Margin="3 3 3 3"
|
||||
Grid.Row="5" Grid.Column="1"
|
||||
FontSize="14" Grid.ColumnSpan="2" >
|
||||
Välj Fil
|
||||
</Button>
|
||||
|
||||
<Image x:Name="SelectedImage" Margin="3 3 3 3"
|
||||
Grid.Row="5" Grid.RowSpan="5"
|
||||
Grid.Column="3" Grid.ColumnSpan="3"
|
||||
VerticalAlignment="Top"
|
||||
Source="{Binding Path=SelectedImage}" >
|
||||
|
||||
</Image>
|
||||
<!--Source="D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG" >-->
|
||||
|
||||
<!--Row 6-->
|
||||
<ListBox x:Name="PictureList"
|
||||
Grid.Row="6" Grid.Column="1"
|
||||
Grid.ColumnSpan="2" Margin="3,3,0,3"
|
||||
MinHeight="300" MinWidth="150"
|
||||
HorizontalAlignment="Left" Width="150">
|
||||
|
||||
</ListBox>
|
||||
|
||||
<!--Row 7-->
|
||||
<Button x:Name="ReorganizeFiles" Margin="3 3 3 3"
|
||||
Grid.Row="7" Grid.Column="1"
|
||||
FontSize="14" Grid.ColumnSpan="2" >
|
||||
Reorganisera Filer
|
||||
</Button>
|
||||
|
||||
<!--Row 8-->
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="1" HorizontalAlignment="Left" Margin="3 3 3 3">
|
||||
Ny Rotkatalog
|
||||
</TextBlock>
|
||||
|
||||
<TextBox x:Name="RootCatalog"
|
||||
Grid.Row="9" Grid.Column="1" Grid.ColumnSpan="2" Margin="3,3,3,3" Height="18" VerticalAlignment="Top"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
Reference in New Issue
Block a user