Merge pull request #185 from ritikaguptams/runtasklistbugfixes

Runtasklistbugfixes
This commit is contained in:
ritikaguptams 2021-08-25 09:17:23 -07:00 коммит произвёл GitHub
Родитель 31a893dbbc 7eca2c2b29
Коммит 7110cc1a6d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 91 добавлений и 31 удалений

Просмотреть файл

@ -58,6 +58,19 @@
</StackPanel>
</Grid>
</Flyout>
<Flyout x:Name="DeleteFlyout" x:Key="DeleteFlyout" >
<StackPanel>
<TextBlock x:Name="DeleteFlyoutTextHeader" x:Uid="DeleteFlyoutTextHeader" Style="{ThemeResource FlyoutPickerTitleTextBlockStyle}" Padding="5"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="CancelDelete" Padding="5" Margin="5" Click="CancelDelete_Click" AutomationProperties.Name="Cancel Delete">
<SymbolIcon Symbol="Cancel"/>
</Button>
<Button x:Name="ConfirmDelete" Padding="5" Margin="5" Click="ConfirmDelete_Click" AutomationProperties.Name="Confirm Delete">
<SymbolIcon Symbol="Accept"/>
</Button>
</StackPanel>
</StackPanel>
</Flyout>
</Page.Resources>
<Grid x:Name="LayoutRoot" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" Margin="50,50,50,50" VerticalAlignment="Stretch">
@ -175,7 +188,7 @@
<Button x:Name="EditBackgroundListButton" x:Uid="EditButton" Margin="10,0,5,0" Click="BgEditButton_Click">
<SymbolIcon Symbol="Edit"/>
</Button>
<Button x:Name="DeleteBackgroundListButton" x:Uid="DeleteButton" Margin="5,0,5,0" Click="BgDeleteButton_Click">
<Button x:Name="DeleteBackgroundListButton" x:Uid="DeleteButton" Margin="5,0,5,0" Click="BgDeleteButton_Click" FlyoutBase.AttachedFlyout="{StaticResource DeleteFlyout}">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE74D;"/>
</Button>
</StackPanel>
@ -205,7 +218,8 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ScrollViewer.VerticalScrollMode="Enabled"
DragItemsCompleted="TaskListView_DragCompleted">
DragItemsCompleted="TaskListView_DragCompleted"
TabFocusNavigation="Cycle">
<ListView.Resources>
<Style TargetType="ListViewItem">
<Setter Property="Template">
@ -224,7 +238,7 @@
<Button x:Name="EditListButton" x:Uid="EditButton" Margin="10,0,5,0" Click="EditButton_Click">
<SymbolIcon Symbol="Edit"/>
</Button>
<Button x:Name="DeleteListButton" x:Uid="DeleteButton" Margin="5,0,5,0" Click="DeleteButton_Click">
<Button x:Name="DeleteListButton" x:Uid="DeleteButton" Margin="5,0,5,0" Click="DeleteButton_Click" FlyoutBase.AttachedFlyout="{StaticResource DeleteFlyout}" AutomationProperties.Name="Delete task">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE74D;"/>
</Button>
</StackPanel>

Просмотреть файл

@ -155,15 +155,58 @@ namespace Microsoft.FactoryOrchestrator.UWP
return false;
}
private void CancelDelete_Click(object sender, RoutedEventArgs e)
{
DeleteFlyout.Hide();
}
/// <summary>
/// Confirm delete flyout
/// </summary>
private async void ConfirmDelete_Click(object sender, RoutedEventArgs e)
{
try
{
if (activeTaskIsNowBg)
{
BackgroundTasksCollection.Remove(activeTask);
activeTaskIsNowBg = false;
}
else
{
TasksCollection.Remove(activeTask);
}
listEdited = true;
if (TasksCollection.Count == 0)
{
TasksHeader.Visibility = Visibility.Collapsed;
}
}
catch (Exception ex)
{
if (ex.GetType() != typeof(FactoryOrchestratorConnectionException))
{
ContentDialog failedDeleteDialog = new ContentDialog
{
Title = resourceLoader.GetString("FOXMLSaveFailed"),
Content = $"{ex.Message}",
CloseButtonText = resourceLoader.GetString("Ok")
};
_ = await failedDeleteDialog.ShowAsync();
}
}
DeleteFlyout.Hide();
}
private void BgDeleteButton_Click(object sender, RoutedEventArgs e)
{
BackgroundTasksCollection.Remove(GetTaskFromButton(sender as Button));
listEdited = true;
if (BackgroundTasksCollection.Count == 0)
{
BgTasksHeader.Visibility = Visibility.Collapsed;
}
var button = sender as Button;
activeTask = GetTaskFromButton(button);
activeTaskIndex = TasksCollection.IndexOf(activeTask);
activeTaskIsNowBg = true;
Flyout.ShowAttachedFlyout(button);
}
private void BgEditButton_Click(object sender, RoutedEventArgs e)
@ -180,13 +223,10 @@ namespace Microsoft.FactoryOrchestrator.UWP
private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
TasksCollection.Remove(GetTaskFromButton(sender as Button));
listEdited = true;
if (TasksCollection.Count == 0)
{
TasksHeader.Visibility = Visibility.Collapsed;
}
var button = sender as Button;
activeTask = GetTaskFromButton(button);
activeTaskIndex = TasksCollection.IndexOf(activeTask);
Flyout.ShowAttachedFlyout(button);
}
private void EditButton_Click(object sender, RoutedEventArgs e)

Просмотреть файл

@ -278,12 +278,16 @@ Manually exported FactoryOrchestratorXML files will not be deleted, but will nee
If "Factory Reset" is chosen, the service is restarted as if it is first boot. First boot and every boot tasks will re-run. Initial TaskLists will be loaded. NOTE: Network communication is not disabled, connected clients may encounter issues and the 'EnableNetworkAccess' setting will be ignored!</value>
</data>
<data name="DeleteButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Delete Task</value>
<comment>Delete a task</comment>
<value>Delete </value>
<comment>Delete </comment>
</data>
<data name="DeleteFlyoutTextHeader.Text" xml:space="preserve">
<value>Confirm Delete: </value>
<comment>Delete Flyout Information</comment>
</data>
<data name="EditButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Edit Task</value>
<comment>Edit a task</comment>
<value>Edit </value>
<comment>Edit </comment>
</data>
<data name="EditFlyoutImagePath" xml:space="preserve">
<value>(Optional) Image or Video Path:</value>

Просмотреть файл

@ -41,6 +41,8 @@
</StackPanel>
</Flyout>
<Flyout x:Name="DeleteFlyout" x:Key="DeleteFlyout" >
<StackPanel>
<TextBlock x:Name="DeleteFlyoutTextHeader" x:Uid="DeleteFlyoutTextHeader" Style="{ThemeResource FlyoutPickerTitleTextBlockStyle}" Padding="5"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="CancelDelete" Padding="5" Margin="5" Click="CancelDelete_Click" AutomationProperties.Name="Cancel Delete">
<SymbolIcon Symbol="Cancel"/>
@ -49,6 +51,7 @@
<SymbolIcon Symbol="Accept"/>
</Button>
</StackPanel>
</StackPanel>
</Flyout>
</Page.Resources>

Просмотреть файл

@ -226,7 +226,6 @@ namespace Microsoft.FactoryOrchestrator.UWP
{
var button = sender as Button;
_activeGuid = GetTaskListGuidFromButton(button);
SaveFlyoutUserPath.Text = _activeGuid.ToString();
Flyout.ShowAttachedFlyout(button);
}