Преглед изворни кода

Перевод функционала отборов, добавления, редактирования и удаления задач с DataGrid в ListView

Данилов Денис пре 1 година
родитељ
комит
0aadc28290

+ 7 - 9
esoft/Pages/AddEditServicePage.xaml

@@ -5,16 +5,15 @@
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
       xmlns:local="clr-namespace:esoft.Pages"
       xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
-      mc:Ignorable="d" 
-      d:DesignHeight="450" d:DesignWidth="800"
-      Title="Создание задачи">
+      mc:Ignorable="d"
+      Title="Создание задачи" Height="1080" Width="1920">
 
     <Grid>
+
         <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Width="700" Background="White">
             <StackPanel VerticalAlignment="Center" Width="700" Height="370" Background="#e8e8e8">
 
                 <StackPanel Height="25" Background="#87d3ff"/>
-
                 <Separator Height="10" Background="{x:Null}" />
 
                 <StackPanel>
@@ -42,9 +41,9 @@
                             <Separator Width="5" Background="{x:Null}" />
                             <ComboBox Name="cbExecutor" Width="276" Height="20" DisplayMemberPath=""></ComboBox>
                         </StackPanel>
-                        
+
                         <Separator Width="17" Background="{x:Null}" />
-                        
+
                         <StackPanel Orientation="Horizontal" Width="200">
                             <TextBlock Style="{StaticResource BlockCommon}" Text="Крайний срок:" FontSize="20"></TextBlock>
                         </StackPanel>
@@ -59,9 +58,9 @@
                             <Separator Width="17" Background="{x:Null}" />
                             <ComboBox Name="cbManager" Width="276" Height="20" DisplayMemberPath=""></ComboBox>
                         </StackPanel>
-                        
+
                         <Separator Width="17" Background="{x:Null}" />
-                        
+
                         <StackPanel Orientation="Horizontal" Width="200">
                             <DatePicker Name="DPickerDateDeadLine" Background="White" Height="25" FontSize="14" Width="190" />
                         </StackPanel>
@@ -124,7 +123,6 @@
                             </Button.Resources>
                         </Button>
                     </StackPanel>
-
                 </StackPanel>
             </StackPanel>
         </StackPanel>

+ 0 - 71
esoft/Pages/ServicesPage.xaml

@@ -1,71 +0,0 @@
-<Page x:Class="esoft.Pages.ServicesPage"
-      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-      xmlns:local="clr-namespace:esoft.Pages"
-      mc:Ignorable="d" 
-      d:DesignHeight="1000"
-      Title="Список задач" Width="1920" Loaded="Page_Loaded">
-
-    <Grid Width="1920">
-        <Grid.RowDefinitions>
-            <RowDefinition Height="50"/>
-            <RowDefinition Height="30"/>
-            <RowDefinition Height="*"/>
-            <RowDefinition Height="70"/>
-        </Grid.RowDefinitions>
-
-        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
-            <ComboBox Margin="5" Width="200" Height="25" Name="cbManager" DisplayMemberPath="" FontSize="16" SelectionChanged="cbStatus_SelectionChanged"/>
-            <ComboBox Margin="5" Width="200" Height="25" Name="cbExecutor" DisplayMemberPath="" FontSize="16" SelectionChanged="cbExecutor_SelectionChanged"/>
-            <ComboBox Margin="5" Width="200" Height="25" Name="cbStatus" FontSize="16" DisplayMemberPath="Name" SelectionChanged="cbStatus_SelectionChanged"/>
-            <Button Height="25" Name="btnClearFilter" Content="Очистка фильтра" Width="200" Margin ="5" FontSize="16" Click="btnClearFilter_Click"/>
-        </StackPanel>
-        
-        <TextBlock Grid.Row="1" Width="auto" FontWeight="Bold" Name="BlockRecords"/>
-
-        <DataGrid x:Name="DGridTask" Width="1850" Height="790" HorizontalAlignment="Center" VerticalAlignment="Top" Grid.Row="2" FontSize="25" AutoGenerateColumns="False" IsReadOnly="True">
-            <DataGrid.Columns>
-                <DataGridTextColumn Header="Название задачи" Binding="{Binding Title}" Width="750"></DataGridTextColumn>
-                <DataGridTextColumn Header="Дата задачи" Binding="{Binding CreateDateTime, StringFormat=\{0:dd.MM.yyyy\}}" Width="160"></DataGridTextColumn>
-                <DataGridTextColumn Header="Исполнитель" Binding="{Binding FioUser}" Width="331"></DataGridTextColumn>
-                <DataGridTextColumn Header="Менеджер" Binding="{Binding FioManager}" Width="331"></DataGridTextColumn>
-                <DataGridTextColumn Header="Статус" Binding="{Binding Status}" Width="220"></DataGridTextColumn>
-                
-                <DataGridTemplateColumn Width="50">
-                    <DataGridTemplateColumn.CellTemplate>
-                        <DataTemplate>
-                            <Button x:Name="BtnEdit" Content="📝" Click="BtnEdit_Click" BorderThickness="0" Background="#87d3ff"/>
-                        </DataTemplate>
-                    </DataGridTemplateColumn.CellTemplate>
-                </DataGridTemplateColumn>
-            </DataGrid.Columns>
-
-        </DataGrid>
-
-        <Button Grid.Row="3" HorizontalAlignment="Left" Name="BtnDeleteTask" Content="Удалить задачу" Width="196" Height="NaN" BorderThickness="0" Style="{StaticResource  StandartButtons}" Margin="1650,10,0,15" Click="BtnDeleteTask_Click">
-            <Button.Resources>
-                <Style TargetType="Border">
-                    <Setter Property="CornerRadius" Value="10"/>
-                </Style>
-            </Button.Resources>
-        </Button>
-
-        <Button Grid.Row="3" HorizontalAlignment="Left" Name="BtnAddTask" Content="Добавить задачу" Width="196" Height="NaN" BorderThickness="0" Style="{StaticResource  StandartButtons}" Margin="1420,10,0,15" Click="BtnAddTask_Click">
-            <Button.Resources>
-                <Style TargetType="Border">
-                    <Setter Property="CornerRadius" Value="10"/>
-                </Style>
-            </Button.Resources>
-        </Button>
-
-        <Button Grid.Row="3" HorizontalAlignment="Left" Name="BtnUpdate" Content="Обновить список" Width="196" Height="NaN" BorderThickness="0" Style="{StaticResource  StandartButtons}" Margin="1190,10,0,15" Click="BtnUpdate_Click">
-            <Button.Resources>
-                <Style TargetType="Border">
-                    <Setter Property="CornerRadius" Value="10"/>
-                </Style>
-            </Button.Resources>
-        </Button>
-    </Grid>
-</Page>

+ 0 - 146
esoft/Pages/ServicesPage.xaml.cs

@@ -1,146 +0,0 @@
-using esoft.Class;
-using esoft.Entities;
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.Linq;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Navigation;
-
-namespace esoft.Pages
-{
-    /// <summary>
-    /// Логика взаимодействия для ServicesPage.xaml
-    /// </summary>
-    public partial class ServicesPage : Page
-    {
-        ActualContext actualContext = new ActualContext();   // Контекст таблиц
-        TaskFill tasks = new TaskFill();                    // Полученный контекст формы
-        List<TaskFill> taskContext = new List<TaskFill>(); // Список задач
-
-        public ServicesPage()
-        {
-            InitializeComponent();
-            FillForm();
-        }
-
-        private void FillForm()
-        {
-            cbStatus.ItemsSource = StatusTask.FillStatus();
-
-            List<User> usersExecutor = actualContext.Users.Where(user => actualContext.Executor.Any(ex => ex.ID == user.ID)).ToList(); // Получение списка исполнителей
-            cbExecutor.ItemsSource = UserInFIO.GroupUser(usersExecutor);
-
-            List<User> usersManager = actualContext.Users.Where(user => actualContext.Manager.Any(manager => manager.ID == user.ID)).ToList(); // Получение списка менеджеров
-            cbManager.ItemsSource = UserInFIO.GroupUser(usersManager);
-        }
-
-        private void BtnEdit_Click(object sender, RoutedEventArgs e)
-        {
-            if (DGridTask.SelectedItem is TaskFill selectedTask)
-            {
-                AddEditServicePage editPage = new AddEditServicePage(selectedTask); // Передаем выбранную задачу в окно редактирования
-                NavigationService.Navigate(editPage); // Открываем окно редактирования
-            }
-            else
-            {
-                MessageBox.Show("Выберите задачу для редактирования.", "Внимание", MessageBoxButton.OK, MessageBoxImage.Information);
-            }
-        }
-
-        private void BtnAddTask_Click(object sender, RoutedEventArgs e)
-        {
-            TaskFill newTask = new TaskFill(); // Создаем новую пустую задачу
-            AddEditServicePage editPage = new AddEditServicePage(newTask);
-            NavigationService.Navigate(editPage); // Открываем окно редактирования
-        }
-
-        private void BtnDeleteTask_Click(object sender, RoutedEventArgs e)
-        {
-            if (DGridTask.SelectedItem is TaskFill selectedTask)
-            {
-                MessageBoxResult result = MessageBox.Show("Вы уверены, что хотите удалить выбранную задачу?",
-                                                          "Подтверждение удаления",
-                                                          MessageBoxButton.YesNo,
-                                                          MessageBoxImage.Question);
-
-                if (result == MessageBoxResult.Yes)
-                {
-                    var context = esoftEntities.GetContext();
-
-                    // Находим задачу по ID или другому уникальному идентификатору
-                    var taskToDelete = context.Task.FirstOrDefault(task => task.ID == selectedTask.ID);
-
-                    if (taskToDelete != null)
-                    {
-                        context.Task.Remove(taskToDelete);
-                        context.SaveChanges(); // Сохраняем изменения в базе данных
-                        DGridTask.ItemsSource = Class.TaskFill.TaskFills(); // Обновляем DataGrid
-                    }
-                }
-            }
-        }
-
-        private void FilterTasks()
-        {
-            // Получение актуальных данных задач из базы или контекста приложения
-            taskContext = Class.TaskFill.TaskFills();
-
-            if (cbStatus.SelectedItem != null)
-            {
-                string selectedStatus = ((StatusTask)cbStatus.SelectedItem).Name;
-                taskContext = taskContext.Where(task => task.Status == selectedStatus).ToList();
-            }
-
-            if (cbExecutor.SelectedItem != null)
-            {
-                string selectedExecutor = cbExecutor.SelectedItem.ToString();
-                taskContext = taskContext.Where(task => task.FioUser == selectedExecutor).ToList();
-            }
-
-            if (cbManager.SelectedItem != null)
-            {
-                string selectedManager = cbManager.SelectedItem.ToString();
-                taskContext = taskContext.Where(task => task.FioManager == selectedManager).ToList();
-            }
-
-            DGridTask.ItemsSource = taskContext;
-        }
-
-        private void cbStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            FilterTasks();
-        }
-
-        private void cbExecutor_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            FilterTasks();
-        }
-
-        private void cbManager_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            FilterTasks();
-        }
-
-        private void btnClearFilter_Click(object sender, RoutedEventArgs e)
-        {
-            // Очистка выбранных значений комбо боксов
-            cbStatus.SelectedItem = null;
-            cbExecutor.SelectedItem = null;
-            cbManager.SelectedItem = null;
-
-            // Очистка фильтров и отображение всех задач без фильтрации
-            DGridTask.ItemsSource = Class.TaskFill.TaskFills();
-        }
-
-        private void BtnUpdate_Click(object sender, RoutedEventArgs e)
-        {
-            DGridTask.ItemsSource = Class.TaskFill.TaskFills(); // Обновляем DataGrid
-        }
-
-        private void Page_Loaded(object sender, RoutedEventArgs e)
-        {
-            DGridTask.ItemsSource = Class.TaskFill.TaskFills(); // Обновляем DataGrid
-        }
-    }
-}

+ 20 - 24
esoft/Pages/TaskLists.xaml

@@ -14,8 +14,8 @@
             <RowDefinition Height="*"></RowDefinition>
         </Grid.RowDefinitions>
 
-        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Height="50">
-            <ComboBox Margin="5" Width="200" Height="25" Name="cbManager" DisplayMemberPath="" FontSize="16" SelectionChanged="cbStatus_SelectionChanged"/>
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Height="50" Margin="0,0,0,-13">
+            <ComboBox Margin="5" Width="200" Height="25" Name="cbManager" DisplayMemberPath="" FontSize="16" SelectionChanged="cbManager_SelectionChanged" />
             <ComboBox Margin="5" Width="200" Height="25" Name="cbExecutor" DisplayMemberPath="" FontSize="16" SelectionChanged="cbExecutor_SelectionChanged"/>
             <ComboBox Margin="5" Width="200" Height="25" Name="cbStatus" FontSize="16" DisplayMemberPath="Name" SelectionChanged="cbStatus_SelectionChanged"/>
             <Button Height="25" Name="btnClearFilter" Content="Очистка фильтра" Width="200" Margin ="5" FontSize="16" Click="btnClearFilter_Click"/>
@@ -24,40 +24,36 @@
         <StackPanel Background="#e6e6e6" Margin="0,15,0,0" Grid.Row="1">
             <TextBlock Text="Название задачи" FontSize="26" Margin="35, 15, 0, 0" VerticalAlignment ="Center" FontWeight="Bold"></TextBlock>
             <TextBlock Text="Дата создания задачи" Margin="800, -35, 0, 0" FontSize="26" VerticalAlignment ="Center" FontWeight="Bold"></TextBlock>
-            <TextBlock Text="Исполнитель" HorizontalAlignment="Center" Margin="600, -35, 0, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
-            <TextBlock Text="Менеджер" HorizontalAlignment="Center" Margin="1100, -35, 0, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
-            <TextBlock Text="Статус" HorizontalAlignment="Right" Margin="0, -35, 125, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
+            <TextBlock Text="Исполнитель" HorizontalAlignment="Center" Margin="550, -35, 0, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
+            <TextBlock Text="Менеджер" HorizontalAlignment="Center" Margin="1065, -35, 0, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
+            <TextBlock Text="Статус" HorizontalAlignment="Right" Margin="0, -35, 170, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
         </StackPanel>
 
-        <ListView Grid.Row="1" Name="LViewTask" Height="720" Width="1900" HorizontalAlignment="Center" VerticalAlignment="Top" Background="{x:Null}" BorderBrush="{x:Null}" Margin="0,83,0,0">
-
-            <ListView.ItemTemplate>
-                <DataTemplate>
-                    <Grid HorizontalAlignment="Center" Width="1900" Height="109">
-
-                        <TextBlock Text="{Binding Title}" FontSize="26" Margin="50, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="750" TextWrapping="Wrap"></TextBlock>
-                        <TextBlock Text="{Binding CreateDateTime, StringFormat='{}{0:dd MMMM yyyy г.}', ConverterCulture='ru-RU'}" Margin="800, 32, 0, 0" FontSize="26"></TextBlock>
-                        <TextBlock Text="{Binding FioUser}" HorizontalAlignment="Center" Margin="600, 0, 0, 0" VerticalAlignment ="Center" FontSize="26"></TextBlock>
-                        <TextBlock Text="{Binding FioManager}" HorizontalAlignment="Center" Margin="1100, 0, 0, 0" VerticalAlignment ="Center" FontSize="26"></TextBlock>
-                        <TextBlock Text="{Binding Status}" Margin="1670, 0, 0, 0" VerticalAlignment ="Center" FontSize="26"></TextBlock>
-
-                    </Grid>
-                </DataTemplate>
-            </ListView.ItemTemplate>
-
+        <ListView Grid.Row="1" Name="LViewTask" Height="720" Width="1900" HorizontalAlignment="Center" VerticalAlignment="Top" Background="{x:Null}" BorderBrush="{x:Null}" Margin="0,83,0,0" Loaded="LViewTask_Loaded" MouseDoubleClick="LViewTask_MouseDoubleClick">
             <ListView.ItemContainerStyle>
                 <Style TargetType="ListViewItem">
-
-                    <Setter Property= "Width" Value="1870"/>
+                    <Setter Property="Margin" Value="0,0,0,10"/>
+                    <Setter Property="Width" Value="1870"/>
                     <Setter Property="Background" Value="#99d3ff"/>
                     <Style.Resources>
                         <Style TargetType="Border">
                             <Setter Property="CornerRadius" Value="30"/>
                         </Style>
                     </Style.Resources>
-
                 </Style>
             </ListView.ItemContainerStyle>
+
+            <ListView.ItemTemplate>
+                <DataTemplate>
+                    <Grid HorizontalAlignment="Center" Width="1900" Height="109">
+                        <TextBlock Text="{Binding Title}" FontSize="26" Margin="50, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="750" TextWrapping="Wrap"></TextBlock>
+                        <TextBlock Text="{Binding CreateDateTime, StringFormat='{}{0:dd MMMM yyyy г.}', ConverterCulture='ru-RU'}" Margin="800, 32, 0, 0"  FontSize="26"></TextBlock>
+                        <TextBlock Text="{Binding FioUser}" Margin="1150, 0, 0, 0" VerticalAlignment="Center" FontSize="26"></TextBlock>
+                        <TextBlock Text="{Binding FioManager}" Margin="1425, 0, 0, 0" VerticalAlignment="Center" FontSize="26"></TextBlock>
+                        <TextBlock Text="{Binding Status}" Margin="1670, 0, 0, 0" VerticalAlignment="Center" FontSize="26"></TextBlock>
+                    </Grid>
+                </DataTemplate>
+            </ListView.ItemTemplate>
         </ListView>
 
         <Button Grid.Row="3" HorizontalAlignment="Left" Name="BtnDeleteTask" Content="Удалить задачу" Width="196" Height="40" BorderThickness="0" Style="{StaticResource  StandartButtons}" Margin="1650,820,0,15" Click="BtnDeleteTask_Click">

+ 98 - 3
esoft/Pages/TaskLists.xaml.cs

@@ -1,4 +1,5 @@
-using esoft.Entities;
+using esoft.Class;
+using esoft.Entities;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -21,20 +22,59 @@ namespace esoft.Pages
     /// </summary>
     public partial class TaskLists : Page
     {
+        ActualContext actualContext = new ActualContext();   // Контекст таблиц
+        TaskFill tasks = new TaskFill();                    // Полученный контекст формы
+        List<TaskFill> taskContext = new List<TaskFill>(); // Список задач
+
         public TaskLists()
         {
             InitializeComponent();
             LViewTask.ItemsSource = Class.TaskFill.TaskFills();
+            FillForm();
         }
 
-        private void BtnAddTask_Click(object sender, RoutedEventArgs e)
+        private void FillForm()
         {
+            cbStatus.ItemsSource = StatusTask.FillStatus();
 
+            List<User> usersExecutor = actualContext.Users.Where(user => actualContext.Executor.Any(ex => ex.ID == user.ID)).ToList(); // Получение списка исполнителей
+            cbExecutor.ItemsSource = UserInFIO.GroupUser(usersExecutor);
+
+            List<User> usersManager = actualContext.Users.Where(user => actualContext.Manager.Any(manager => manager.ID == user.ID)).ToList(); // Получение списка менеджеров
+            cbManager.ItemsSource = UserInFIO.GroupUser(usersManager);
+        }
+
+        private void BtnAddTask_Click(object sender, RoutedEventArgs e)
+        {
+            TaskFill newTask = new TaskFill(); // Создаем новую пустую задачу
+            AddEditServicePage editPage = new AddEditServicePage(newTask);
+            NavigationService.Navigate(editPage); // Открываем окно редактирования
         }
 
         private void BtnDeleteTask_Click(object sender, RoutedEventArgs e)
         {
+            if (LViewTask.SelectedItem is TaskFill selectedTask)
+            {
+                MessageBoxResult result = MessageBox.Show("Вы уверены, что хотите удалить выбранную задачу?",
+                                                          "Подтверждение удаления",
+                                                          MessageBoxButton.YesNo,
+                                                          MessageBoxImage.Question);
 
+                if (result == MessageBoxResult.Yes)
+                {
+                    var context = esoftEntities.GetContext();
+
+                    // Находим задачу по ID или другому уникальному идентификатору
+                    var taskToDelete = context.Task.FirstOrDefault(task => task.ID == selectedTask.ID);
+
+                    if (taskToDelete != null)
+                    {
+                        context.Task.Remove(taskToDelete);
+                        context.SaveChanges(); // Сохраняем изменения в базе данных
+                        LViewTask.ItemsSource = Class.TaskFill.TaskFills(); // Обновляем DataGrid
+                    }
+                }
+            }
         }
 
         private void BtnUpdate_Click(object sender, RoutedEventArgs e)
@@ -42,19 +82,74 @@ namespace esoft.Pages
             LViewTask.ItemsSource = Class.TaskFill.TaskFills();
         }
 
-        private void cbStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        private void FilterTasks()
         {
+            // Получение актуальных данных задач из базы или контекста приложения
+            taskContext = Class.TaskFill.TaskFills();
+
+            if (cbStatus.SelectedItem != null)
+            {
+                string selectedStatus = ((StatusTask)cbStatus.SelectedItem).Name;
+                taskContext = taskContext.Where(task => task.Status == selectedStatus).ToList();
+            }
 
+            if (cbExecutor.SelectedItem != null)
+            {
+                string selectedExecutor = cbExecutor.SelectedItem.ToString();
+                taskContext = taskContext.Where(task => task.FioUser == selectedExecutor).ToList();
+            }
+
+            if (cbManager.SelectedItem != null)
+            {
+                string selectedManager = cbManager.SelectedItem.ToString();
+                taskContext = taskContext.Where(task => task.FioManager == selectedManager).ToList();
+            }
+
+            LViewTask.ItemsSource = taskContext;
+        }
+
+        private void cbStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            FilterTasks();
         }
 
         private void cbExecutor_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
+            FilterTasks();
+        }
 
+        private void cbManager_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            FilterTasks();
         }
 
         private void btnClearFilter_Click(object sender, RoutedEventArgs e)
         {
+            // Очистка выбранных значений комбо боксов
+            cbStatus.SelectedItem = null;
+            cbExecutor.SelectedItem = null;
+            cbManager.SelectedItem = null;
 
+            // Очистка фильтров и отображение всех задач без фильтрации
+            LViewTask.ItemsSource = Class.TaskFill.TaskFills();
+        }
+
+        private void LViewTask_Loaded(object sender, RoutedEventArgs e)
+        {
+            LViewTask.ItemsSource = Class.TaskFill.TaskFills();
+        }
+
+        private void LViewTask_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+        {
+            if (LViewTask.SelectedItem is TaskFill selectedTask)
+            {
+                AddEditServicePage editPage = new AddEditServicePage(selectedTask); // Передаем выбранную задачу в окно редактирования
+                NavigationService.Navigate(editPage); // Открываем окно редактирования
+            }
+            else
+            {
+                MessageBox.Show("Выберите задачу для редактирования.", "Внимание", MessageBoxButton.OK, MessageBoxImage.Information);
+            }
         }
     }
 }

+ 0 - 7
esoft/esoft.csproj

@@ -141,10 +141,6 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Pages\ServicesPage.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
     <Page Include="Pages\TaskLists.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -157,9 +153,6 @@
     <Compile Include="Pages\LoginPage.xaml.cs">
       <DependentUpon>LoginPage.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Pages\ServicesPage.xaml.cs">
-      <DependentUpon>ServicesPage.xaml</DependentUpon>
-    </Compile>
     <Compile Include="Pages\TaskLists.xaml.cs">
       <DependentUpon>TaskLists.xaml</DependentUpon>
     </Compile>