Last active
August 29, 2015 14:15
-
-
Save kokudori/77357eafe061c1e23563 to your computer and use it in GitHub Desktop.
Twitter Client Modoki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Livet; | |
namespace LivetWPFApplication1.ViewModels | |
{ | |
public class ConfigViewModel : ViewModel | |
{ | |
public void Initialize() | |
{ | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="LivetWPFApplication1.Views.ConfigWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" | |
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" | |
xmlns:l="http://schemas.livet-mvvm.net/2011/wpf" | |
xmlns:v="clr-namespace:LivetWPFApplication1.Views" | |
xmlns:vm="clr-namespace:LivetWPFApplication1.ViewModels" | |
Title="ConfigWindow" Height="350" Width="525"> | |
<Window.DataContext> | |
<vm:ConfigViewModel/> | |
</Window.DataContext> | |
<i:Interaction.Triggers> | |
<i:EventTrigger EventName="ContentRendered"> | |
<l:LivetCallMethodAction MethodTarget="{Binding}" MethodName="Initialize"/> | |
</i:EventTrigger> | |
<i:EventTrigger EventName="Closed"> | |
<l:DataContextDisposeAction/> | |
</i:EventTrigger> | |
</i:Interaction.Triggers> | |
<Grid> | |
</Grid> | |
</Window> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using Livet; | |
using Livet.EventListeners; | |
using LivetWPFApplication1.Models; | |
namespace LivetWPFApplication1.ViewModels | |
{ | |
public class TimeLineViewModel : ViewModel | |
{ | |
Authorizer authorizer = new Authorizer(); | |
Twitter twitter = new Twitter(); | |
PropertyChangedEventListener propertyListener; | |
public void Initialize() | |
{ | |
propertyListener = new PropertyChangedEventListener(twitter) { | |
() => twitter.TweetCount, (_, __) => RaisePropertyChanged(() => TweetCount) | |
}; | |
if (!authorizer.IsAuthorized) | |
{ | |
// TODO 認証の必要がある! | |
} | |
twitter.TweetCount = 100; | |
twitter.Tweets.Add("いぇーい"); | |
} | |
public int TweetCount { get { return twitter.TweetCount; } } | |
public ObservableCollection<string> Tweets { get { return twitter.Tweets; } } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="LivetWPFApplication1.Views.TimeLineWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" | |
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" | |
xmlns:l="http://schemas.livet-mvvm.net/2011/wpf" | |
xmlns:v="clr-namespace:LivetWPFApplication1.Views" | |
xmlns:vm="clr-namespace:LivetWPFApplication1.ViewModels" | |
Title="TimeLineWindow" Height="350" Width="525"> | |
<Window.DataContext> | |
<vm:TimeLineViewModel/> | |
</Window.DataContext> | |
<i:Interaction.Triggers> | |
<i:EventTrigger EventName="ContentRendered"> | |
<l:LivetCallMethodAction MethodTarget="{Binding}" MethodName="Initialize"/> | |
</i:EventTrigger> | |
<i:EventTrigger EventName="Closed"> | |
<l:DataContextDisposeAction/> | |
</i:EventTrigger> | |
</i:Interaction.Triggers> | |
<Grid> | |
<Label Content="{Binding TweetCount}" HorizontalAlignment="Left" Margin="200,38,0,0" VerticalAlignment="Top"/> | |
<ListView ItemsSource="{Binding Tweets}" HorizontalAlignment="Left" Height="100" Margin="179,92,0,0" VerticalAlignment="Top" Width="100"> | |
<ListView.View> | |
<GridView> | |
<GridViewColumn/> | |
</GridView> | |
</ListView.View> | |
</ListView> | |
</Grid> | |
</Window> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Livet; | |
using System.Collections.ObjectModel; | |
namespace LivetWPFApplication1.Models | |
{ | |
public class Twitter : NotificationObject | |
{ | |
#region TweetCount変更通知プロパティ | |
private int _TweetCount; | |
public int TweetCount | |
{ | |
get | |
{ return _TweetCount; } | |
set | |
{ | |
if (_TweetCount == value) | |
return; | |
_TweetCount = value; | |
RaisePropertyChanged(); | |
} | |
} | |
#endregion | |
readonly ObservableCollection<string> tweets = new ObservableCollection<string>(); | |
public ObservableCollection<string> Tweets { get { return tweets; } } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment