• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

http://sourceforge.jp/projects/futonwriter/の旧リポジトリ


Commit MetaInfo

Revisioncac08ec475462016f9942582797481b06c80634f (tree)
Zeit2011-05-19 23:22:00
Autorazyobuzin <azyobuzin@user...>
Commiterazyobuzin

Log Message

タブで分けるようにしたけどテスト不足

Ändern Zusammenfassung

Diff

--- a/HatenaDiaryClient/HatenaDiaryClient.csproj
+++ b/HatenaDiaryClient/HatenaDiaryClient.csproj
@@ -70,6 +70,7 @@
7070 <SubType>Designer</SubType>
7171 </ApplicationDefinition>
7272 <Compile Include="Models\Settings.cs" />
73+ <Compile Include="Models\Tab.cs" />
7374 <Compile Include="ViewModels\SettingsWindowViewModel.cs" />
7475 <Compile Include="Views\SettingsWindow.xaml.cs">
7576 <DependentUpon>SettingsWindow.xaml</DependentUpon>
--- a/HatenaDiaryClient/Models/Model.cs
+++ b/HatenaDiaryClient/Models/Model.cs
@@ -18,7 +18,8 @@ namespace Azyobuzi.HatenaDiaryClient.Models
1818
1919 internal Model()
2020 {
21- Editing = new BlogItem();
21+ this.Tabs = new DispatcherCollection<Tab>(DispatcherHelper.UIDispatcher);
22+ this.Tabs.Add(new Tab() { Editing = new BlogItem(), TitleText = "新規" });
2223 }
2324
2425 private Settings settings;
@@ -70,12 +71,14 @@ namespace Azyobuzi.HatenaDiaryClient.Models
7071 private HatenaDiary diary = new HatenaDiary();
7172 private HatenaFotolife fotolife = new HatenaFotolife();
7273
73- public BlogItem Editing { private set; get; }
74+ public DispatcherCollection<Tab> Tabs { private set; get; }
7475
75- public void Post()
76+ public void Post(Tab tab)
7677 {
77- var re = diary.PostEntry(this.Editing.Title, this.Editing.Content);
78- this.Editing.Entry = re;
78+ var re = diary.PostEntry(tab.Editing.Title, tab.Editing.Content);
79+ tab.Editing.Entry = re;
80+ tab.TitleText = re.Title;
81+ tab.Modified = false;
7982 }
8083 }
8184 }
--- a/HatenaDiaryClient/Models/Settings.cs
+++ b/HatenaDiaryClient/Models/Settings.cs
@@ -7,7 +7,7 @@ using Livet;
77
88 namespace Azyobuzi.HatenaDiaryClient.Models
99 {
10- public class Settings : NotifyObject, ICloneable
10+ public class Settings : NotifyObject
1111 {
1212 private static readonly string settingsFile =
1313 Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]) + @"\settings.xml";
@@ -68,11 +68,5 @@ namespace Azyobuzi.HatenaDiaryClient.Models
6868 xs.Serialize(sw, this);
6969 }
7070 }
71-
72- public object Clone()
73- {
74- this.Save();
75- return Load();
76- }
7771 }
7872 }
--- /dev/null
+++ b/HatenaDiaryClient/Models/Tab.cs
@@ -0,0 +1,63 @@
1+using System.ComponentModel;
2+using Livet;
3+
4+namespace Azyobuzi.HatenaDiaryClient.Models
5+{
6+ class Tab : NotifyObject
7+ {
8+
9+ BlogItem _Editing;
10+
11+ public BlogItem Editing
12+ {
13+ get
14+ { return _Editing; }
15+ set
16+ {
17+ if (_Editing == value)
18+ return;
19+ if (this._Editing != null)
20+ this._Editing.PropertyChanged -= this.Editing_PropertyChanged;
21+ _Editing = value;
22+ this._Editing.PropertyChanged += this.Editing_PropertyChanged;
23+ RaisePropertyChanged("Editing");
24+ }
25+ }
26+
27+ private void Editing_PropertyChanged(object sender, PropertyChangedEventArgs e)
28+ {
29+ this.Modified = true;
30+ }
31+
32+ string _TitleText;
33+
34+ public string TitleText
35+ {
36+ get
37+ { return _TitleText; }
38+ set
39+ {
40+ if (_TitleText == value)
41+ return;
42+ _TitleText = value;
43+ RaisePropertyChanged("TitleText");
44+ }
45+ }
46+
47+ bool _Modified;
48+
49+ public bool Modified
50+ {
51+ get
52+ { return _Modified; }
53+ set
54+ {
55+ if (_Modified == value)
56+ return;
57+ _Modified = value;
58+ RaisePropertyChanged("Modified");
59+ }
60+ }
61+
62+ }
63+}
--- a/HatenaDiaryClient/ViewModels/MainWindowViewModel.cs
+++ b/HatenaDiaryClient/ViewModels/MainWindowViewModel.cs
@@ -65,15 +65,32 @@ namespace Azyobuzi.HatenaDiaryClient.ViewModels
6565 }
6666 }
6767
68- public BlogItem Editing
68+ public DispatcherCollection<Tab> Tabs
6969 {
7070 get
7171 {
72- return model.Editing;
72+ return this.model.Tabs;
7373 }
7474 }
7575
7676
77+ Tab _SelectedTab;
78+
79+ public Tab SelectedTab
80+ {
81+ get
82+ { return _SelectedTab; }
83+ set
84+ {
85+ if (_SelectedTab == value)
86+ return;
87+ _SelectedTab = value;
88+ RaisePropertyChanged("SelectedTab");
89+ }
90+ }
91+
92+
93+
7794 #region PostCommand
7895 DelegateCommand _PostCommand;
7996
@@ -89,12 +106,14 @@ namespace Azyobuzi.HatenaDiaryClient.ViewModels
89106
90107 private bool CanPost()
91108 {
92- return this.model.SetIdPassword && !string.IsNullOrEmpty(this.Editing.Content);
109+ return this.model.SetIdPassword &&
110+ this.SelectedTab != null &&
111+ !string.IsNullOrEmpty(this.SelectedTab.Editing.Content);
93112 }
94113
95114 private void Post()
96115 {
97- this.model.Post();
116+ this.model.Post(this.SelectedTab);
98117 }
99118 #endregion
100119
--- a/HatenaDiaryClient/Views/MainWindow.xaml
+++ b/HatenaDiaryClient/Views/MainWindow.xaml
@@ -28,7 +28,6 @@
2828 <Grid.RowDefinitions>
2929 <RowDefinition Height="auto"/>
3030 <RowDefinition Height="auto"/>
31- <RowDefinition Height="auto"/>
3231 <RowDefinition/>
3332 </Grid.RowDefinitions>
3433
@@ -60,17 +59,50 @@
6059 </StackPanel>
6160 </Button>
6261 </WrapPanel>
63-
64- <Grid Grid.Row="2" Background="LightBlue">
65- <Grid.ColumnDefinitions>
66- <ColumnDefinition Width="auto"/>
67- <ColumnDefinition/>
68- </Grid.ColumnDefinitions>
69-
70- <TextBlock Grid.Column="0" Text="タイトル :" Margin="3,3,3,3" VerticalAlignment="Center" Foreground="White"/>
71- <TextBox Grid.Column="1" Margin="3,3,3,3" Text="{Binding Editing.Title, UpdateSourceTrigger=PropertyChanged}"/>
72- </Grid>
73-
74- <TextBox Grid.Row="3" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" Text="{Binding Editing.Content, UpdateSourceTrigger=PropertyChanged}"/>
62+
63+ <TabControl Grid.Row="2" ItemsSource="{Binding Tabs}" SelectedItem="{Binding SelectedTab}">
64+ <TabControl.ItemTemplate>
65+ <DataTemplate>
66+ <DataTemplate.Resources>
67+ <Style x:Key="ModifiedText" TargetType="TextBlock">
68+ <Style.Triggers>
69+ <DataTrigger Binding="{Binding Modified}" Value="True">
70+ <DataTrigger.Setters>
71+ <Setter Property="Text" Value="*"/>
72+ </DataTrigger.Setters>
73+ </DataTrigger>
74+ </Style.Triggers>
75+ </Style>
76+ </DataTemplate.Resources>
77+
78+ <StackPanel Orientation="Horizontal">
79+ <TextBlock Text="{Binding TitleText}"/>
80+ <TextBlock Style="{StaticResource ModifiedText}" />
81+ </StackPanel>
82+ </DataTemplate>
83+ </TabControl.ItemTemplate>
84+ <TabControl.ContentTemplate>
85+ <DataTemplate>
86+ <Grid>
87+ <Grid.RowDefinitions>
88+ <RowDefinition Height="auto"/>
89+ <RowDefinition/>
90+ </Grid.RowDefinitions>
91+
92+ <Grid Grid.Row="0" Background="LightBlue">
93+ <Grid.ColumnDefinitions>
94+ <ColumnDefinition Width="auto"/>
95+ <ColumnDefinition/>
96+ </Grid.ColumnDefinitions>
97+
98+ <TextBlock Grid.Column="0" Text="タイトル :" Margin="3,3,3,3" VerticalAlignment="Center" Foreground="White"/>
99+ <TextBox Grid.Column="1" Margin="3,3,3,3" Text="{Binding Editing.Title, UpdateSourceTrigger=PropertyChanged}"/>
100+ </Grid>
101+
102+ <TextBox Grid.Row="1" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" Text="{Binding Editing.Content, UpdateSourceTrigger=PropertyChanged}"/>
103+ </Grid>
104+ </DataTemplate>
105+ </TabControl.ContentTemplate>
106+ </TabControl>
75107 </Grid>
76108 </Window>