Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ProcessWatchImpl/Scone/MainWindow.xaml.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 43 by netseed, Mon Dec 14 14:56:59 2009 UTC revision 44 by netseed, Tue Dec 15 16:20:54 2009 UTC
# Line 31  namespace Toast.Scone Line 31  namespace Toast.Scone
31                  {                  {
32                          InitializeComponent();                          InitializeComponent();
33    
34                          repeater = new Repeater(this.Dispatcher);                          repeater = new Repeater(Dispatcher);
35                          repeater.ProgramStarted += new EventHandler<Toast.NicoNico.DetectProgramStartEventArgs>(repeater__ProgramStarted);                          repeater.ProgramStarted += new EventHandler<Toast.NicoNico.DetectProgramStartEventArgs>(repeater__ProgramStarted);
36    
37    
38                          repeater.TwitterWriteFailed += new EventHandler<TwitterWriteFailedEventArgs>(repeater__TwitterWriteFailed);                          repeater.TwitterWriteFailed += new EventHandler<TwitterWriteFailedEventArgs>(repeater__TwitterWriteFailed);
39    
40                          this.cheker = new TextBoxChecker();                          cheker = new TextBoxChecker();
41                          this.cheker.AddControl(this.smileId);                          cheker.AddControl(smileId);
42                          this.cheker.AddControl(this.password);                          cheker.AddControl(password);
43                          this.cheker.AddControl(this.userId);                          cheker.AddControl(userId);
44                          this.cheker.AddControl(this.format);                          cheker.AddControl(format);
45    
46                          CommandBinding bind = new CommandBinding(StartCommand, new ExecutedRoutedEventHandler(StartCommandExecute),                          CommandBinding bind = new CommandBinding(StartCommand, new ExecutedRoutedEventHandler(StartCommandExecute),
47                                  new CanExecuteRoutedEventHandler(CanExecuteStartCommand));                                  new CanExecuteRoutedEventHandler(CanExecuteStartCommand));
48    
49                          this.CommandBindings.Add(bind);                          CommandBindings.Add(bind);
50    
51                          bind = new CommandBinding(StopCommand, new ExecutedRoutedEventHandler(StopCommandExecute),                          bind = new CommandBinding(StopCommand, new ExecutedRoutedEventHandler(StopCommandExecute),
52                                  new CanExecuteRoutedEventHandler(CanExecuteStopCommand));                                  new CanExecuteRoutedEventHandler(CanExecuteStopCommand));
53    
54                          this.CommandBindings.Add(bind);                          CommandBindings.Add(bind);
55    
56                          this.password.Password = properties::Settings.Default.PassWord;                          password.Password = properties::Settings.Default.PassWord;
57                          this.userId.EmbodimentText = properties::Settings.Default.UserId;                          userId.EmbodimentText = properties::Settings.Default.UserId;
58                          this.format.EmbodimentText = properties::Settings.Default.Format;                          format.EmbodimentText = properties::Settings.Default.Format;
59    
60                          this.smileId.EmbodimentText = properties::Settings.Default.SmileID;                          smileId.EmbodimentText = properties::Settings.Default.SmileID;
61    
62                          SmileIdValidationRule rule = new SmileIdValidationRule();                          SmileIdValidationRule rule = new SmileIdValidationRule();
63    
64                          if (!rule.Validate(this.smileId.EmbodimentText, System.Threading.Thread.CurrentThread.CurrentCulture).IsValid)                          if (!rule.Validate(smileId.EmbodimentText, System.Threading.Thread.CurrentThread.CurrentCulture).IsValid)
65                          {                          {
66                                  this.smileId.IsInvalid = true;                                  smileId.IsInvalid = true;
67                          }                          }
68    
69                          startCommandCanExecute = false;                          startCommandCanExecute = false;
# Line 123  namespace Toast.Scone Line 123  namespace Toast.Scone
123                                   MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);                                   MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
124    
125                          CommandBindings[0].Command.CanExecute(null);                          CommandBindings[0].Command.CanExecute(null);
126                          this.userId.Focus();                          userId.Focus();
127                          //エラー直後に、なんかしたけりゃここにかく                          //エラー直後に、なんかしたけりゃここにかく
128                  }                  }
129    
# Line 170  namespace Toast.Scone Line 170  namespace Toast.Scone
170                  }                  }
171    
172    
173                    
174                  private bool CheckStopInterlock()                  private bool CheckStopInterlock()
175                  {                  {
176                          bool State = false;                          bool State = false;
# Line 209  namespace Toast.Scone Line 209  namespace Toast.Scone
209    
210                  private void WriteState(string message)                  private void WriteState(string message)
211                  {                  {
212                          this.mainStatus.Text = message;                          mainStatus.Text = message;
213                  }                  }
214    
215    
216                  private void StartCommandExecute(object sender, ExecutedRoutedEventArgs e)                  private void StartCommandExecute(object sender, ExecutedRoutedEventArgs e)
217                  {                  {
218                          repeater.Start(uint.Parse(this.smileId.EmbodimentText),                          repeater.Start(uint.Parse(smileId.EmbodimentText),
219                                  this.userId.EmbodimentText,                                  userId.EmbodimentText,
220                                  this.password.Password,                                  password.Password,
221                                  this.format.EmbodimentText);                                  format.EmbodimentText);
222                          //CheckStopInterlock();                          //CheckStopInterlock();
223    
224                          WriteState(properties::Resources.Start);                          WriteState(properties::Resources.Start);
# Line 263  namespace Toast.Scone Line 263  namespace Toast.Scone
263                  private void Format_EmbodimentTextChanged(object sender, EmbodimentTextChangedEventArgs e)                  private void Format_EmbodimentTextChanged(object sender, EmbodimentTextChangedEventArgs e)
264                  {                  {
265                          properties::Settings.Default.Format =                          properties::Settings.Default.Format =
266                                  e.Current == null ? string.Empty : this.format.EmbodimentText;                                  e.Current == null ? string.Empty : format.EmbodimentText;
267    
268                          properties::Settings.Default.Save();                          properties::Settings.Default.Save();
269                  }                  }
# Line 271  namespace Toast.Scone Line 271  namespace Toast.Scone
271                  private void SmileId_EmbodimentTextChanged(object sender, EmbodimentTextChangedEventArgs e)                  private void SmileId_EmbodimentTextChanged(object sender, EmbodimentTextChangedEventArgs e)
272                  {                  {
273    
274                          if (!this.smileId.IsInvalid)                          if (!smileId.IsInvalid)
275                          {                          {
276                                  properties::Settings.Default.SmileID =                                  properties::Settings.Default.SmileID =
277                                          e.Current == null ? string.Empty : this.smileId.EmbodimentText;                                          e.Current == null ? string.Empty : smileId.EmbodimentText;
278    
279                                  properties::Settings.Default.Save();                                  properties::Settings.Default.Save();
280                          }                          }
# Line 283  namespace Toast.Scone Line 283  namespace Toast.Scone
283                  private void UserId_EmbodimentTextChanged(object sender, EmbodimentTextChangedEventArgs e)                  private void UserId_EmbodimentTextChanged(object sender, EmbodimentTextChangedEventArgs e)
284                  {                  {
285                          properties::Settings.Default.UserId =                          properties::Settings.Default.UserId =
286                                  e.Current == null ? string.Empty : this.userId.EmbodimentText;                                  e.Current == null ? string.Empty : userId.EmbodimentText;
287    
288                          properties::Settings.Default.Save();                          properties::Settings.Default.Save();
289                  }                  }
# Line 292  namespace Toast.Scone Line 292  namespace Toast.Scone
292                  {                  {
293    
294                          properties::Settings.Default.PassWord =                          properties::Settings.Default.PassWord =
295                                  this.password.Password == null ? string.Empty : this.password.Password;                                  password.Password == null ? string.Empty : password.Password;
296    
297                          properties::Settings.Default.Save();                          properties::Settings.Default.Save();
298                  }                  }

Legend:
Removed from v.43  
changed lines
  Added in v.44

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26