Commit 2c166106 authored by M3156's avatar M3156
Browse files

scrollability improvements and commentWindow

parent 014b5018
No preview for this file type
......@@ -14,15 +14,9 @@
<ListBox x:Name="lbxComments" Height="470" Background="#e6f2ff" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionChanged="lbxComments_SelectionChanged">
</ListBox>
</Border>
<StackPanel Orientation="Horizontal" Margin="30 30 30 10" Height="100">
<TextBox x:Name="txtComment" Height="100" Width="600" HorizontalAlignment="Left" KeyUp="TxtComment_KeyUp" TextWrapping="Wrap" Padding="5" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"/>
<StackPanel>
<Button x:Name="btnComment" Content="New Comment" Width="110" Height="45" Margin="20 0 0 0" Click="btnComment_Click"/>
<Button x:Name="btnReply" Content="Reply" Width="110" Height="45" Margin="20 10 0 0"/>
</StackPanel>
<TextBox x:Name="txtComment" Margin="30 30 30 10" Height="100" Width="730" HorizontalAlignment="Center" KeyUp="TxtComment_KeyUp" TextWrapping="Wrap" Padding="5" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"/>
</StackPanel>
<TextBlock x:Name="CommentMessages" Margin="30 0"/>
<Label x:Name="lblCommentMessages" Margin="30 0" Height="30" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="10 0"/>
</StackPanel>
</Grid>
</Window>
......@@ -21,6 +21,7 @@ namespace iTool
{
private List<Comment> comments;
private List<User> users;
private int? selectedComment = null;
public CommentWindow()
{
InitializeComponent();
......@@ -45,9 +46,17 @@ namespace iTool
private void lbxComments_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Object selected = lbxComments.SelectedItem;
StackPanel selected = (StackPanel)lbxComments.SelectedItem;
if (selected != null)
{
Label l = (Label)selected.Children[0];
string content = l.Content.ToString();
selectedComment = int.Parse(content.Split('#')[content.Split('#').Length - 1]);
}
lblCommentMessages.Content = $"Comment #{selectedComment} is selected, reply to it by typing a comment and pressing 'Enter'";
}
private void btnComment_Click(object sender, RoutedEventArgs e)
......@@ -57,27 +66,18 @@ namespace iTool
private void AddComment()
{
Label user = new Label();
user.Content = $"{Active.FirstName} {Active.LastName}, User ID: #{Active.UserID}";
user.FontSize = 16;
user.FontWeight = FontWeights.Bold;
TextBlock txbComment1 = new TextBlock();
txbComment1.Text = txtComment.Text;
txbComment1.VerticalAlignment = VerticalAlignment.Top;
txbComment1.HorizontalAlignment = HorizontalAlignment.Left;
txbComment1.FontSize = 16;
txbComment1.TextWrapping = TextWrapping.Wrap;
StackPanel spComment = new StackPanel();
spComment.Margin = new Thickness(0, 10, 10, 10);
spComment.Orientation = Orientation.Vertical;
spComment.HorizontalAlignment = HorizontalAlignment.Left;
spComment.Children.Add(user);
spComment.Children.Add(txbComment1);
lbxComments.Items.Add(spComment);
string body = txtComment.Text;
string query;
if(selectedComment == null)
query = $"INSERT INTO comment (commentDate, commentText, userID, commentParentID, toolID) VALUES (CURRENT_TIMESTAMP,'{body}',{Active.UserID},null,{Active.ToolID});";
else
query = $"INSERT INTO comment (commentDate, commentText, userID, commentParentID, toolID) VALUES (CURRENT_TIMESTAMP,'{body}',{Active.UserID},{selectedComment},{Active.ToolID});";
DB.AddCommentToMysql(query);
lbxComments.Items.Clear();
comments = DB.GetCommentsFromMysql(Active.ToolID);
IniComments();
}
private User GetUser(int userID)
......@@ -101,7 +101,6 @@ namespace iTool
private void IniComments()
{
int margin = 0;
foreach (Comment item in comments)
{
if (item.CommentParentID == null)
......@@ -161,7 +160,7 @@ namespace iTool
reply1.TextWrapping = TextWrapping.Wrap;
StackPanel spReply = new StackPanel();
spReply.Margin = new Thickness(margin += 20, 10, 0, 0);
spReply.Margin = new Thickness(20, 10, 0, 0);
spReply.Orientation = Orientation.Vertical;
spReply.HorizontalAlignment = HorizontalAlignment.Left;
spReply.Children.Add(lbComment);
......
......@@ -6,6 +6,7 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using MySql.Data;
using MySql.Data.MySqlClient;
......@@ -773,7 +774,10 @@ namespace iTool
float avgRating = 0F;
while (reader.Read())
{
avgRating = float.Parse(reader.GetString(0));
if(!reader.IsDBNull(0))
avgRating = float.Parse(reader.GetString(0));
else
avgRating = 0;
}
return avgRating;
}
......@@ -785,5 +789,28 @@ namespace iTool
throw;
}
}
public static bool AddCommentToMysql(string query)
{
try
{
string connStr = GetConnectionString();
string sql = $"{query}";
using (MySqlConnection conn = new MySqlConnection(connStr))
{
conn.Open();
MySqlCommand cmd = new MySqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
return true;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
}
}
......@@ -40,59 +40,61 @@
</StackPanel>
<StackPanel Orientation="Horizontal" x:Name="spToolDescription" HorizontalAlignment="Left" Height="415" Margin="0" VerticalAlignment="Top" Width="1200" Background="#e6f2ff">
<StackPanel Width="400">
<Label Margin="30 30 0 0" Content="Tool" FontSize="26" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Border x:Name="bdrToolImage" HorizontalAlignment="Left" Margin="30 0 60 0" BorderThickness="1" BorderBrush="Black" >
<Image x:Name="imgTool" HorizontalAlignment="Left" Margin="0" Width="{Binding ElementName=bdrToolImage, Path=ActualWidth}" Source="images/no_picture_tool.png"/>
</Border>
</StackPanel>
<StackPanel Width="400">
<StackPanel Orientation="Horizontal" Margin="0 40 0 0">
<Label Margin="30 20 0 0" Content="Name: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbToolName" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Margin="30 20 0 0" Content="Conditioin: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbToolCondition" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0 0 0 0">
<Label Margin="30 20 0 0" Content="Price €/day: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbPrice" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
<Label Margin="5 20 0 0" Content="€" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</StackPanel>
<Grid Height="415">
<ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Hidden">
<StackPanel Orientation="Horizontal" x:Name="spToolDescription" HorizontalAlignment="Left" Height="415" Margin="0" VerticalAlignment="Top" Width="1200" Background="#e6f2ff">
<StackPanel Width="400">
<Label Margin="30 30 0 0" Content="Tool" FontSize="26" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Border x:Name="bdrToolImage" HorizontalAlignment="Left" Margin="30 0 90 0" BorderThickness="1" BorderBrush="Black" >
<Image x:Name="imgTool" HorizontalAlignment="Left" Margin="0" Width="{Binding ElementName=bdrToolImage, Path=ActualWidth}" Source="images/no_picture_tool.png"/>
</Border>
<Label Margin="30 20 0 0" Content="Description: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbDescription" Padding="5 0 0 0" FontSize="16" Margin="30 0" TextWrapping="Wrap"/>
<StackPanel Orientation="Horizontal">
<Label Margin="30 20 0 0" Content="Owner: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbOwner" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Margin="30 20 0 0" Content="Phone number: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbNumber" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
<StackPanel Width="400">
<StackPanel Orientation="Horizontal" Margin="0 40 0 0">
<Label Margin="30 20 0 0" Content="Rent for:" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold"/>
<TextBox x:Name="txtDays" Height="30" Width="60" Margin="10 20 0 0" TextChanged="TxtDays_TextChanged" VerticalContentAlignment="Center"/>
<Label Margin="5 20 0 0" Content="days" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Margin="30 20 0 0" Content="Total price:" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="txbTotalPrice" Margin="10 20 0 0" FontSize="16" VerticalAlignment="Center"/>
</StackPanel>
<Button Height="30" Margin="30 20 20 0" Width="100" HorizontalAlignment="Left" Content="Rent" FontSize="16" Click="Button_Click"/>
<Button x:Name="btnComment" Height="30" Margin="30 20 20 0" Width="100" HorizontalAlignment="Left" Content="Comment" FontSize="16" Click="BtnComment_Click"/>
</StackPanel>
</StackPanel>
<StackPanel Width="400">
<StackPanel Orientation="Horizontal" Margin="0 40 0 0">
<Label Margin="30 20 0 0" Content="Name: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbToolName" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Margin="30 20 0 0" Content="Conditioin: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbToolCondition" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0 0 0 0">
<Label Margin="30 20 0 0" Content="Price €/day: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbPrice" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
<Label Margin="5 20 0 0" Content="€" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</StackPanel>
<Label Margin="30 20 0 0" Content="Description: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbDescription" Padding="5 0 0 0" FontSize="16" Margin="30 0" TextWrapping="Wrap"/>
<StackPanel Orientation="Horizontal">
<Label Margin="30 20 0 0" Content="Owner: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbOwner" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Margin="30 20 0 0" Content="Phone number: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Width="130"/>
<TextBlock x:Name="txbNumber" Padding="5 0 0 0" FontSize="16" Margin="5 20 0 0" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
<StackPanel Width="400">
<StackPanel Orientation="Horizontal" Margin="0 40 0 0">
<Label Margin="30 20 0 0" Content="Rent for:" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold"/>
<TextBox x:Name="txtDays" Height="30" Width="60" Margin="10 20 0 0" TextChanged="TxtDays_TextChanged" VerticalContentAlignment="Center"/>
<Label Margin="5 20 0 0" Content="days" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Margin="30 20 0 0" Content="Total price:" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="txbTotalPrice" Margin="10 20 0 0" FontSize="16" VerticalAlignment="Center"/>
</StackPanel>
<Button Height="30" Margin="30 20 20 0" Width="100" HorizontalAlignment="Left" Content="Rent" FontSize="16" Click="Button_Click"/>
<Button x:Name="btnComment" Height="30" Margin="30 20 20 0" Width="100" HorizontalAlignment="Left" Content="Comment" FontSize="16" Click="BtnComment_Click"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
<TextBox x:Name="txbMessages" Text="Here you can see all tools that are available for rent. Use filters or the search bar to find a tool for you." FontSize="16" Height="37" VerticalContentAlignment="Center" Padding="10 0 10 0"/>
</StackPanel>
......
......@@ -70,7 +70,7 @@ namespace iTool
Active.LastName = dataSet.Tables[0].Rows[0]["userSurname"].ToString();
Active.ImageFileName = dataSet.Tables[0].Rows[0]["userPicture"].ToString();
if (string.IsNullOrEmpty(Active.ImagePath))
if (string.IsNullOrEmpty(Active.ImageFileName))
{
Active.ImageSource = new BitmapImage(new Uri($"{Active.ProjectPath}/images/no_picture.png", UriKind.RelativeOrAbsolute));
}
......
......@@ -17,43 +17,51 @@
<Grid>
<StackPanel VerticalAlignment="Top" Height="770">
<Label Content="iTool: User Profile" FontSize="30" HorizontalContentAlignment="Center" FontWeight="Bold" Background="#aaaaaa"/>
<Label x:Name="lblUserProfile" Content="iTool: User Profile" FontSize="30" HorizontalContentAlignment="Left" FontWeight="Bold" Background="#aaaaaa" Padding="20 5 0 5"/>
<StackPanel Orientation="Horizontal">
<StackPanel Width="300" Height="680" Background="LightGray" VerticalAlignment="Stretch">
<Border x:Name="bdrProfileImg" Width="200" Margin="50 50 50 0" BorderThickness="1" BorderBrush="Black">
<Image x:Name="imgUserProfile" Width="{Binding ElementName=bdrProfileImg, Path=ActualWidth}"/>
</Border>
<TextBlock x:Name="txbUserID" HorizontalAlignment="Left" Height="20" Margin="75 20 0 0" FontSize="18" FontWeight="Medium"/>
<TextBlock x:Name="txbFirstName" HorizontalAlignment="Left" Height="20" Margin="75 0 0 0" FontSize="18" FontWeight="Medium"/>
<TextBlock x:Name="txbLastName" HorizontalAlignment="Left" Height="20" Margin="75 0 0 0" FontSize="18" FontWeight="Medium"/>
<TextBlock x:Name="txbAvgRating" HorizontalAlignment="Left" Height="20" Margin="75 0 0 30" FontSize="18" FontWeight="Medium"/>
<Button x:Name="btnAddTool" Width="150" Height="30" Content="Add a tool" Margin="5" Click="btnAddTool_Click"/>
<Button x:Name="btnEditProfile" Width="150" Height="30" Content="Edit profile" Margin="5" Click="BtnEditProfile_Click"/>
<Button x:Name="btnDeleteProfile" Width="150" Height="30" Content="Delete profile" Margin="5" Click="BtnDeleteProfile_Click"/>
<Button x:Name="btnBackToMainPage" Width="150" Height="30" Content="Back to main page" Margin="5" Click="BtnBackToMainPage_Click"/>
<Button x:Name="btnLogout" Width="150" Height="30" Content="Log out" Margin="5" Click="BtnLogout_Click"/>
</StackPanel>
<ListBox Width="600" Height="680">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Focusable" Value="False"/>
</Style>
</ListBox.ItemContainerStyle>
<Label Content="My Tools" HorizontalContentAlignment="Center" FontSize="26" FontWeight="Bold" Margin="20 30 0 0"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<DataGrid x:Name="dgMyTools" Margin="20 0" MaxHeight="250" IsReadOnly="True" SelectionMode="Single" SelectionChanged="DgMyTools_SelectionChanged" AutoGeneratedColumns="dgMyTools_AutoGeneratedColumns" KeyUp="DgMyTools_KeyUp"/>
<Grid Height="680">
<ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Hidden">
<StackPanel Width="300" Height="680" Background="LightGray" VerticalAlignment="Stretch">
<Border x:Name="bdrProfileImg" Width="200" Margin="50 50 50 0" BorderThickness="1" BorderBrush="Black">
<Image x:Name="imgUserProfile" Width="{Binding ElementName=bdrProfileImg, Path=ActualWidth}"/>
</Border>
<TextBlock x:Name="txbUserID" HorizontalAlignment="Left" Height="20" Margin="75 20 0 0" FontSize="18" FontWeight="Medium"/>
<!--
<TextBlock x:Name="txbFirstName" HorizontalAlignment="Left" Height="20" Margin="75 0 0 0" FontSize="18" FontWeight="Medium"/>
<TextBlock x:Name="txbLastName" HorizontalAlignment="Left" Height="20" Margin="75 0 0 0" FontSize="18" FontWeight="Medium"/>
-->
<TextBlock x:Name="txbAvgRating" HorizontalAlignment="Left" Height="20" Margin="75 0 0 30" FontSize="18" FontWeight="Medium"/>
<Button x:Name="btnAddTool" Width="150" Height="30" Content="Add a tool" Margin="5" Click="btnAddTool_Click"/>
<Button x:Name="btnEditProfile" Width="150" Height="30" Content="Edit profile" Margin="5" Click="BtnEditProfile_Click"/>
<Button x:Name="btnDeleteProfile" Width="150" Height="30" Content="Delete profile" Margin="5" Click="BtnDeleteProfile_Click"/>
<Button x:Name="btnBackToMainPage" Width="150" Height="30" Content="Back to main page" Margin="5" Click="BtnBackToMainPage_Click"/>
<Button x:Name="btnLogout" Width="150" Height="30" Content="Log out" Margin="5" Click="BtnLogout_Click"/>
</StackPanel>
</ScrollViewer>
<Label Content="My Rented Tools" HorizontalContentAlignment="Center" FontSize="26" FontWeight="Bold" Margin="20 30 0 0"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<DataGrid x:Name="dgRentedToolsByMe" Margin="20 0" MaxHeight="250" IsReadOnly="True" SelectionMode="Single" SelectionChanged="DgRentedToolsByMe_SelectionChanged" AutoGeneratedColumns="dgRentedToolsByMe_AutoGeneratedColumns" KeyUp="DgRentedToolsByMe_KeyUp"/>
</ScrollViewer>
<Label Content="My Transactions" HorizontalContentAlignment="Center" FontSize="26" FontWeight="Bold" Margin="20 30 0 0"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<DataGrid x:Name="dgMyTransactions" Margin="20 0" MaxHeight="250" IsReadOnly="True" SelectionMode="Single" AutoGeneratedColumns="dgMyTransactions_AutoGeneratedColumns" SelectionChanged="dgMyTransactions_SelectionChanged" KeyUp="DgMyTransactions_KeyUp"/>
</Grid>
<Grid Height="680">
<ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Hidden">
<StackPanel Width="600" Height="680">
<Label Content="My Tools" HorizontalContentAlignment="Center" FontSize="26" FontWeight="Bold" Margin="0 30 0 0"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<DataGrid x:Name="dgMyTools" Margin="20 0" MaxHeight="250" IsReadOnly="True" SelectionMode="Single" SelectionChanged="DgMyTools_SelectionChanged" AutoGeneratedColumns="dgMyTools_AutoGeneratedColumns" KeyUp="DgMyTools_KeyUp"/>
</ScrollViewer>
<Label Content="My Rented Tools" HorizontalContentAlignment="Center" FontSize="26" FontWeight="Bold" Margin="0 30 0 0"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<DataGrid x:Name="dgRentedToolsByMe" Margin="20 0" MaxHeight="250" IsReadOnly="True" SelectionMode="Single" SelectionChanged="DgRentedToolsByMe_SelectionChanged" AutoGeneratedColumns="dgRentedToolsByMe_AutoGeneratedColumns" KeyUp="DgRentedToolsByMe_KeyUp"/>
</ScrollViewer>
<Label Content="My Transactions" HorizontalContentAlignment="Center" FontSize="26" FontWeight="Bold" Margin="0 30 0 0"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<DataGrid x:Name="dgMyTransactions" Margin="20 0" MaxHeight="250" IsReadOnly="True" SelectionMode="Single" AutoGeneratedColumns="dgMyTransactions_AutoGeneratedColumns" SelectionChanged="dgMyTransactions_SelectionChanged" KeyUp="DgMyTransactions_KeyUp"/>
</ScrollViewer>
</StackPanel>
</ScrollViewer>
</ListBox>
</Grid>
<StackPanel Width="300" Background="#e6f2ff">
<Grid Height="680">
<ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Hidden">
<StackPanel Width="300" Background="#e6f2ff" MaxHeight="680">
<Label x:Name="lblHeader" Margin="30 30 0 0" Content="Tool" FontSize="26" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Border x:Name="bdrToolProfile" BorderThickness="1" BorderBrush="Black" Width="200" Margin="30 20 0 0" HorizontalAlignment="Left">
<Image x:Name="imgToolProfile" Width="{Binding ElementName=bdrToolProfile, Path=ActualWidth}"/>
......@@ -67,6 +75,8 @@
<Label x:Name="lblHeader4" Margin="30 20 0 0" Content="Description: " FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="txbDescriptionProfile" FontSize="16" Margin="30 0" TextWrapping="Wrap"/>
</StackPanel>
</ScrollViewer>
</Grid>
</StackPanel>
<TextBox x:Name="txbMessagesProfile" FontSize="16" Height="40" VerticalContentAlignment="Center" Padding="10 0 10 0"/>
......
......@@ -33,8 +33,9 @@ namespace iTool
private void IniMyStuff()
{
imgUserProfile.Source = Active.ImageSource;
txbFirstName.Text = Active.FirstName;
txbLastName.Text = Active.LastName;
lblUserProfile.Content = $"{Active.FirstName} {Active.LastName}";
//txbFirstName.Text = Active.FirstName;
//txbLastName.Text = Active.LastName;
txbUserID.Text = $"User ID: {Active.UserID.ToString()}";
txbAvgRating.Text = $"Average rating: {DB.GetAvgRatingFromMysql(Active.UserID).ToString()}";
......
......@@ -5,18 +5,19 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:iTool"
mc:Ignorable="d"
Title="iTool: Rating" Height="450" Width="500">
Title="iTool: Rating" Height="450" Width="500"
SizeToContent="WidthAndHeight">
<Grid Background="#3a3939">
<StackPanel >
<Label Content="iTool: Rating" HorizontalContentAlignment="Center" Foreground="#c1fff9" FontSize="30" FontWeight="Black"/>
<Label x:Name="lblRatedPerson" Content="Name" HorizontalContentAlignment="Center" Foreground="#c1fff9" Margin="0 10 0 0" FontSize="18"/>
<Label x:Name="lblRatedPerson" Content="Name" HorizontalContentAlignment="Center" Foreground="#c1fff9" Margin="10 10 10 0" FontSize="18"/>
<Label x:Name="lblRating" Content="Give rating (1-5)" HorizontalContentAlignment="Center" Foreground="#c1fff9" Margin="0 10 0 0"/>
<TextBox x:Name="txtRating" Background="#c1fff9" Height="30" Width="100" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="18" Foreground="Black" MaxLength="1"/>
<Label x:Name="lblRatingFeedback" Content="Comments (optional)" HorizontalContentAlignment="Center" Foreground="#c1fff9" Margin="0 10 0 0"/>
<TextBox x:Name="txtRatingComments" Background="#c1fff9" Height="100" TextWrapping="Wrap" Width="300" HorizontalAlignment="Center" MaxLength="1000" TextChanged="TxtRatingComments_TextChanged"/>
<Label x:Name="lblCharCount" Width="300" Content="1000" HorizontalContentAlignment="Right" Foreground="#c1fff9"/>
<Button x:Name="btnGiveRating" Content="Give rating" Margin="0 0 0 0" Width="100" Click="BtnGiveRating_Click"/>
<Label x:Name="lblMessagesRating" HorizontalContentAlignment="Center" Foreground="#c1fff9" Margin="0 10 0 0"/>
<Label x:Name="lblMessagesRating" HorizontalContentAlignment="Center" Foreground="#c1fff9" Margin="0 10"/>
</StackPanel>
</Grid>
......
......@@ -148,8 +148,11 @@ namespace iTool
cmd.ExecuteNonQuery();
con.Close();
System.IO.File.Copy(Active.dirPath, Active.relativePath, true);
File.SetAttributes(Active.relativePath, FileAttributes.Normal);
if (!string.IsNullOrEmpty(txtPic.Text))
{
System.IO.File.Copy(Active.dirPath, Active.relativePath, true);
File.SetAttributes(Active.relativePath, FileAttributes.Normal);
}
Active.imgFile = null;
......
......@@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>7wKIrC1ZxU2bnKFIhf4r8uVbYw7D8BdoeqthlIvRx9Q=</dsig:DigestValue>
<dsig:DigestValue>fFYP6atDY0crn6UNBMdpFBFqRKw4+VDbFgQsv1ixGZE=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
......
......@@ -55,14 +55,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="iTool.exe" size="994744">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="iTool.exe" size="995256">
<assemblyIdentity name="iTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>MN+zakMX0lUcQLsKHHbpYWDPT6fv02BRfruYsioAfAs=</dsig:DigestValue>
<dsig:DigestValue>E1gOfnlBpBUrAPDZWuXX1TarIGjNNnpA7HzUDkKmeWQ=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment