Преглед на файлове

первая страница готова

Priquo преди 2 години
родител
ревизия
029a3d01f4

+ 17 - 0
DemoexamUser11/DemoexamUser11.csproj

@@ -34,6 +34,9 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup>
+    <ApplicationIcon>images\Приятный шелест.ico</ApplicationIcon>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
@@ -124,6 +127,12 @@
     <Compile Include="Supplier.cs">
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
+    <Compile Include="windows\WindowChangePriority.xaml.cs">
+      <DependentUpon>WindowChangePriority.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="windows\WindowEditAgent.xaml.cs">
+      <DependentUpon>WindowEditAgent.xaml</DependentUpon>
+    </Compile>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -140,6 +149,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="windows\WindowChangePriority.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="windows\WindowEditAgent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs">

+ 3 - 2
DemoexamUser11/pages/AgentsList.xaml

@@ -36,8 +36,9 @@
             <TextBox x:Name="textBoxSearch" Width="250" Height="25" Margin="10 0" TextChanged="Search"/>
             <ComboBox x:Name="comboBoxSort" Width="150" Height="25" SelectionChanged="Filter"/>
             <Button x:Name="buttomBigger" Content="Изменить порядок" Height="25" Click="buttomBigger_Click"/>
-            <ComboBox x:Name="comboBoxFilter" Width="150" Height="25" Margin="10 0" SelectionChanged="Filter"/>
+            <ComboBox x:Name="comboBoxFilter" Width="100" Height="25" Margin="10 0" SelectionChanged="Filter"/>
+            <Button x:Name="buttomChangePriority" Content="Изменить приоритет" Height="25" Click="buttomChangePriority_Click"/>
         </StackPanel>
-        <ListBox x:Name="listBoxAgents" ItemTemplate="{StaticResource listItemTemplate}" Grid.Row="1"/>
+        <ListBox x:Name="listBoxAgents" ItemTemplate="{StaticResource listItemTemplate}" Grid.Row="1" SelectionMode="Multiple"/>
     </Grid>
 </Page>

+ 16 - 0
DemoexamUser11/pages/AgentsList.xaml.cs

@@ -13,6 +13,7 @@ using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
 using DemoexamUser11.classes;
+using DemoexamUser11.windows;
 
 namespace DemoexamUser11.pages
 {
@@ -103,5 +104,20 @@ namespace DemoexamUser11.pages
             listBoxAgents.ItemsSource = agentsForFilters;
             listBoxAgents.Items.Refresh();
         }
+
+        private void buttomChangePriority_Click(object sender, RoutedEventArgs e)
+        {
+            if (listBoxAgents.SelectedItems.Count != 0)
+            {
+                List<Agent> agentsListNew = new List<Agent>();
+                foreach (var item in listBoxAgents.SelectedItems)
+                {
+                    agentsListNew.Add((Agent)item);
+                }
+                WindowChangePriority changePriority = new WindowChangePriority(agentsListNew);
+                changePriority.ShowDialog();
+                listBoxAgents.Items.Refresh();
+            }
+        }
     }
 }

+ 18 - 0
DemoexamUser11/windows/WindowChangePriority.xaml

@@ -0,0 +1,18 @@
+<Window x:Class="DemoexamUser11.windows.WindowChangePriority"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:DemoexamUser11.windows"
+        mc:Ignorable="d"
+        Title="Изменение приоритета" Height="150" Width="300">
+    <Grid>
+        <StackPanel Orientation="Vertical">
+            <GroupBox Header="Введите новое значение приоритета">
+                <TextBox x:Name="textBoxValue"/>
+            </GroupBox>
+            <Button x:Name="buttonSave" Content="Сохранить" Click="buttonSave_Click"/>
+            <Button x:Name="buttonBack" Content="Назад" Click="buttonBack_Click"/>
+        </StackPanel>
+    </Grid>
+</Window>

+ 60 - 0
DemoexamUser11/windows/WindowChangePriority.xaml.cs

@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using DemoexamUser11.classes;
+
+namespace DemoexamUser11.windows
+{
+    /// <summary>
+    /// Логика взаимодействия для WindowChangePriority.xaml
+    /// </summary>
+    public partial class WindowChangePriority : Window
+    {
+        List<Agent> agents;
+        public WindowChangePriority(List<Agent> agents)
+        {
+            InitializeComponent();
+            this.agents = agents;
+            agents.Sort(delegate (Agent a1, Agent a2)
+            {
+                return a1.Priority.CompareTo(a2.Priority);
+            });
+            textBoxValue.Text = agents.Last().Priority.ToString();
+        }
+
+        private void buttonBack_Click(object sender, RoutedEventArgs e)
+        {
+            Close();
+        }
+
+        private void buttonSave_Click(object sender, RoutedEventArgs e)
+        {
+            if (textBoxValue.Text.Replace(" ", "") != "")
+            {
+                try
+                {
+                    foreach (Agent agent in agents)
+                    {
+                        BaseConnector.BaseConnect.Agent.FirstOrDefault(x => x.ID == agent.ID).Priority = Convert.ToInt32(textBoxValue.Text);
+                    }
+                    MessageBox.Show("Успех!");
+                }
+                catch
+                {
+                    MessageBox.Show("Не удалось изменить приоритеты! Введите число");
+                }
+                
+            }
+        }
+    }
+}

+ 12 - 0
DemoexamUser11/windows/WindowEditAgent.xaml

@@ -0,0 +1,12 @@
+<Window x:Class="DemoexamUser11.windows.WindowEditAgent"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:DemoexamUser11.windows"
+        mc:Ignorable="d"
+        Title="WindowEditAgent" Height="450" Width="800">
+    <Grid>
+        
+    </Grid>
+</Window>

+ 27 - 0
DemoexamUser11/windows/WindowEditAgent.xaml.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace DemoexamUser11.windows
+{
+    /// <summary>
+    /// Логика взаимодействия для WindowEditAgent.xaml
+    /// </summary>
+    public partial class WindowEditAgent : Window
+    {
+        public WindowEditAgent()
+        {
+            InitializeComponent();
+        }
+    }
+}