Skip to content

Commit

Permalink
애플리케이션 샘플 동작 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
droplet92 committed Jan 19, 2021
1 parent 4ea0ab3 commit ef058dc
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 3 deletions.
1 change: 1 addition & 0 deletions FileAccessControlAgent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<Compile Include="src\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="src\Samples\MenuSamples.cs" />
<Compile Include="src\ViewModels\MainMenuViewModel.cs" />
<Compile Include="src\ViewModels\MainWindowViewModel.cs" />
<Compile Include="src\ViewModels\NavigationBarViewModel.cs" />
Expand Down
36 changes: 36 additions & 0 deletions src/Samples/MenuSamples.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using FileAccessControlAgent.Views;
using System.Collections.Generic;

namespace FileAccessControlAgent.Samples
{
public static class MenuSamples
{
public static List<LogInfo> LogListSample
{
get
{
List<LogInfo> sampleLogList = new List<LogInfo>();
sampleLogList.Add(new LogInfo("2021-01-18", "WINWORD.EXE", "파일 접근 거부"));
sampleLogList.Add(new LogInfo("2021-01-19", "WINWORD.EXE", "파일 접근 거부"));
sampleLogList.Add(new LogInfo("2021-01-20", "EXCEL.EXE", "파일 접근 거부"));
return sampleLogList;
}
}

public static List<string> RecentNotifications
{
get
{
List<string> sampleRecentNotifications = new List<string>();
sampleRecentNotifications.Add("화이트리스트 업데이트 v1.0.1");
sampleRecentNotifications.Add("화이트리스트 업데이트 v1.0.0");
return sampleRecentNotifications;
}
}

public static string WhitelistVersion
{
get { return "v1.0.1"; }
}
}
}
36 changes: 35 additions & 1 deletion src/Views/FileAccessRejectLogMenuView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,46 @@
using System.Windows.Controls;
using System;
using System.Windows;
using System.Windows.Controls;
using FileAccessControlAgent.Samples;

namespace FileAccessControlAgent.Views
{
public class LogInfo
{
public string DateTime { get; private set; }
public string ProgramName { get; private set; }
public string Preview { get; private set; }

public LogInfo(string dateTime, string programName, string preview)
{
DateTime = dateTime;
ProgramName = programName;
Preview = preview;
}
}

public partial class FileAccessRejectLogMenuView : UserControl
{
public FileAccessRejectLogMenuView()
{
InitializeComponent();

var logListView = logList.Content as ListView;
foreach (LogInfo logInfo in MenuSamples.LogListSample)
{
logListView.Items.Add(logInfo);
}
logListView.SelectionChanged += LogListSelectionChanged;
}

private void LogListSelectionChanged(object sender, SelectionChangedEventArgs e)
{
var logInfo = (logList.Content as ListView).SelectedItem as LogInfo;

(logDetails.Content as TextBlock).Text =
$"DateTime :\t{logInfo.DateTime}" + Environment.NewLine +
$"ProgramName :\t{logInfo.ProgramName}" + Environment.NewLine +
$"Preview :\t{logInfo.Preview}";
}
}
}
23 changes: 22 additions & 1 deletion src/Views/InquiryMenuView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Windows.Controls;
using System;
using System.Windows;
using System.Windows.Controls;

namespace FileAccessControlAgent.Views
{
Expand All @@ -8,5 +10,24 @@ public InquiryMenuView()
{
InitializeComponent();
}

private void SendInquiry(object sender, RoutedEventArgs e)
{
if (titleTextBox.Text.Length == 0
|| logTextBox.Text.Length == 0
|| contentTextBox.Text.Length == 0)
{
MessageBox.Show("일부 항목이 비어있습니다.\n모든 항목을 채운 뒤 보내기 버튼을 눌러주세요.");
return;
}

string confirmMessage =
$"제목 :\t{titleTextBox.Text}" + Environment.NewLine +
$"로그 :\t{logTextBox.Text}" + Environment.NewLine +
$"내용 :\t{contentTextBox.Text}";

if (MessageBox.Show(confirmMessage, "문의사항 보내기", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
MessageBox.Show("문의사항을 보냈습니다.");
}
}
}
20 changes: 19 additions & 1 deletion src/Views/MainMenuView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Windows.Controls;
using FileAccessControlAgent.Samples;
using System;
using System.Windows;
using System.Windows.Controls;

namespace FileAccessControlAgent.Views
{
Expand All @@ -7,6 +10,21 @@ public partial class MainMenuView : UserControl
public MainMenuView()
{
InitializeComponent();

// (recentNotifications.Content as TextBlock).Text update
var notificationTextBlock = recentNotifications.Content as TextBlock;
foreach (string notification in MenuSamples.RecentNotifications)
{
notificationTextBlock.Text += notification + Environment.NewLine;
}

// whitelistVersion update
whitelistVersion.Text = MenuSamples.WhitelistVersion;
}

private void Update(object sender, RoutedEventArgs e)
{
MessageBox.Show("화이트리스트를 업데이트했습니다.");
}
}
}
10 changes: 10 additions & 0 deletions src/Views/NavigationBarView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace FileAccessControlAgent.Views
{
Expand All @@ -10,6 +11,7 @@ public partial class NavigationBarView : UserControl
public NavigationBarView()
{
InitializeComponent();
mainMenuNavigateButton.Background = Brushes.Gray;
DataContext = new NavigationBarViewModel();
}

Expand All @@ -25,6 +27,14 @@ public Action<object> action
private void OnButtonClick(object sender, RoutedEventArgs e)
{
action.Invoke((sender as Button).Tag);
ColorButtons(sender as Button);
}

private void ColorButtons(Button clicked)
{
foreach (Button item in stackPanel.Children)
item.Background = SystemColors.ControlLightBrush;
clicked.Background = Brushes.Gray;
}
}
}

0 comments on commit ef058dc

Please sign in to comment.