4 changed files with 179 additions and 1 deletions
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<gui:OptionPanel |
||||
x:Class="ICSharpCode.SharpDevelop.Gui.OptionPanels.TaskListXaml" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:sd="clr-namespace:ICSharpCode.SharpDevelop" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels"> |
||||
<GroupBox |
||||
Header="Comment Tags"> |
||||
<Grid |
||||
Margin="5"> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition |
||||
Height="30"></RowDefinition> |
||||
<RowDefinition |
||||
Height="30"></RowDefinition> |
||||
<RowDefinition |
||||
Height="20"></RowDefinition> |
||||
<RowDefinition |
||||
Height="30"></RowDefinition> |
||||
<RowDefinition |
||||
Height="30"></RowDefinition> |
||||
<RowDefinition |
||||
Height="30"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
<TextBlock |
||||
Text="Token List"></TextBlock> |
||||
<ListView |
||||
x:Name="listView" |
||||
Margin="5,0,5,5" |
||||
Grid.Row="1" |
||||
Grid.RowSpan="6" |
||||
SelectionChanged="ListView_SelectionChanged"></ListView> |
||||
<TextBlock |
||||
Text="Name" |
||||
Margin="5,0,0,0" |
||||
Grid.Column="1"></TextBlock> |
||||
<TextBox |
||||
x:Name="taskText" |
||||
Margin="5,0,5,0" |
||||
Grid.Column="1" |
||||
Grid.Row="1"></TextBox> |
||||
<Button |
||||
Content="Add" |
||||
Click="AddButton_Click" |
||||
Margin="5,2,5, 3" |
||||
Grid.Row="3" |
||||
Grid.Column="1"></Button> |
||||
<Button |
||||
x:Name="changeBtn" |
||||
Content="Change" |
||||
IsEnabled="False" |
||||
Click="ChangeBtn_Click" |
||||
Grid.Row="4" |
||||
Grid.Column="1" |
||||
Margin="5,3,5,3"></Button> |
||||
<Button |
||||
x:Name="removeBtn" |
||||
Click="RemoveBtn_Click" |
||||
Margin="5,2,5,5" |
||||
Content="Remove" |
||||
Grid.Row="5" |
||||
Grid.Column="1" |
||||
IsEnabled="False"></Button> |
||||
</Grid> |
||||
</GroupBox> |
||||
</gui:OptionPanel> |
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 26.02.2012 |
||||
* Time: 19:46 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for TaskListXaml.xaml
|
||||
/// </summary>
|
||||
public partial class TaskListXaml : OptionPanel |
||||
{ |
||||
public TaskListXaml() |
||||
{ |
||||
InitializeComponent(); |
||||
string[] tokens = ParserService.TaskListTokens; |
||||
foreach (var token in tokens) { |
||||
listView.Items.Add(token); |
||||
}; |
||||
} |
||||
|
||||
|
||||
void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||||
{ |
||||
if (listView.SelectedItem != null) { |
||||
taskText.Text = listView.SelectedItem.ToString(); |
||||
changeBtn.IsEnabled = true; |
||||
removeBtn.IsEnabled = true; |
||||
} |
||||
} |
||||
|
||||
|
||||
void ChangeBtn_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
if ((listView.SelectedItem != null) && (!String.IsNullOrWhiteSpace(taskText.Text))) { |
||||
var i = listView.Items.IndexOf(listView.SelectedItem); |
||||
listView.Items[i] = taskText.Text; |
||||
} |
||||
} |
||||
|
||||
|
||||
void RemoveBtn_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
if (listView.SelectedItem != null) { |
||||
listView.Items.Remove(listView.SelectedItem); |
||||
taskText.Text = String.Empty; |
||||
} |
||||
} |
||||
|
||||
|
||||
void AddButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
if (!String.IsNullOrWhiteSpace(taskText.Text)) { |
||||
var i = listView.Items.IndexOf(taskText.Text); |
||||
if (i < 0) { |
||||
|
||||
listView.Items.Add(taskText.Text); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public override bool SaveOptions() |
||||
{ |
||||
List<string> tokens = new List<string>(); |
||||
|
||||
foreach (var item in listView.Items) { |
||||
string text = item.ToString().Trim(); |
||||
if (text.Length > 0) { |
||||
tokens.Add(text); |
||||
} |
||||
} |
||||
ParserService.TaskListTokens = tokens.ToArray(); |
||||
return true; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue