Ȥ Blog

Ruby,C#

2011ǯ06

C#iPhone - ܡɤ̵ͭˤäƥƥԽꥢΥѹ

ƥȥꥢΥեܤȼưŪ˥ܡɤɽ褦ˤʤäƤޤƥȥꥢ̤äѤɽƤꤹȡɽ줿ܡɤƥȥꥢΰ򱣤Ƥޤ礬ޤ
Τ褦ʲ̥쥤Ȥξϡܡɤɽɽ˱ƥƥȥꥢΥѹɬפФƤޤ
Ȥ櫓ǤäƤߤޤ
ݥȤ
  • NSNotificationCenter.DefaultCenter.AddObserver ܡɤɽɽΤ褦ˤ
  • ResignFirstResponder - ȥ뤫ե򳰤 - .NETǸȤLostFocus
äƤȤǤ礦

using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;

namespace HelloIPhoneTextView
{
	public class Application
	{
		static void Main (string[] args)
		{
			UIApplication.Main (args);
		}
	}
	
	// The name AppDelegate is referenced in the MainWindow.xib file.
	public partial class AppDelegate : UIApplicationDelegate
	{
		
		NSObject kbdShow, kbdHide;
		
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			doneButton.Enabled = false;
			
			kbdShow = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillShowNotification, delegate(NSNotification n) {
				var kbdFrame = UIKeyboard.BoundsFromNotification (n);
				var frame = textView.Frame;
				frame.Height -= kbdFrame.Height;
				textView.Frame = frame;
				doneButton.Enabled = true;
			});
			
			kbdHide = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, delegate(NSNotification n) {
				var kbdFrame = UIKeyboard.BoundsFromNotification (n);
				var frame = textView.Frame;
				frame.Height += kbdFrame.Height;
				textView.Frame = frame;
				doneButton.Enabled = false;
			});
			
			doneButton.TouchDown += (sender, e) => {
				textView.ResignFirstResponder ();
			};
			
			
			window.MakeKeyAndVisible ();
	
			return true;
		}
	
		// This method is required in iPhoneOS 3.0
		public override void OnActivated (UIApplication application)
		{
		}
		
		public override void WillTerminate (UIApplication application)
		{
			NSNotificationCenter.DefaultCenter.RemoveObserver (kbdShow);
			NSNotificationCenter.DefaultCenter.RemoveObserver (kbdHide);
		}
		
	}
}



C#iPhone - UiWebViewWeb֥饦Ƥߤ

ǤΥå٥ȤȤե٥ȤȤåǤоݤDOMǤȤȽФɡˡΤʤ

ץ˥Ѥ˥ǥ륹η뺧Կʶʤ򥮥ǺäƤߤޤ뤵Τ褯狼ʤʤäƤ

ѡ1

ѡ2
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace HelloIPhoneWebBrowser
{
	public class Application
	{
		static void Main (string[] args)
		{
			UIApplication.Main (args);
		}
	}
	
	// The name AppDelegate is referenced in the MainWindow.xib file.
	public partial class AppDelegate : UIApplicationDelegate
	{
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
		
			myWebBrowser.ShouldStartLoad = delegate(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) {
				if (navigationType == UIWebViewNavigationType.LinkClicked) {
					UIApplication.SharedApplication.OpenUrl (request.Url);
					return false;
				}
				return true;
			};
			
			goButton.TouchDown += (sender, e) => {
				myWebBrowser.LoadRequest (new NSUrlRequest (new NSUrl (myUrlText.Text)));
			};
			
			myWebBrowser.LoadStarted += (sender, e) => {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
				myUrlText.Text = myWebBrowser.Request.Url.AbsoluteString;
			};
			
			myWebBrowser.LoadFinished += (sender, e) => {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
				myUrlText.Text = myWebBrowser.Request.Url.AbsoluteString;
				this.updateNavigateButtonEnabled ();
			};
			
			
			myWebBrowser.LoadError += (object sender, UIWebErrorArgs e) => {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
				using (var alert = new UIAlertView("Error!!", e.Error.LocalizedDescription, null, "OK", null)) {
					alert.Show ();
				}
				this.updateNavigateButtonEnabled ();
			};
			
			backButton.TouchDown += (sender, e) => {
				myWebBrowser.GoBack ();
			};
			
			forwardButton.TouchDown += (sender, e) => {
				myWebBrowser.GoForward ();
			};
			

			window.MakeKeyAndVisible ();
	
			return true;
		}
		
		void updateNavigateButtonEnabled ()
		{ 
			backButton.Enabled = myWebBrowser.CanGoBack;
			forwardButton.Enabled = myWebBrowser.CanGoForward;
		}
		
	
		// This method is required in iPhoneOS 3.0
		public override void OnActivated (UIApplication application)
		{
		}
	}
}


C#iPhone - UiScrollViewȤäƥڡ᤯ꤷƤߤ

KindleץStanzaץʤɥڡ᤯ΤǤ륢ץ꤬ޤºݤ˻椬᤯褦ʻи̤ѤʤΤǤз빽ñˤǤƤޤ褦Ǥ


C# iPhone - UiBuilderȤ鷺UIȤäƤߤ

ȥ饤Ƥߤϥܥȥ٥֤UiBuilderȤäƤäƤߤΤǤޤ줬ʤʤΤǤ礦ɡºݤäȤäץȤưŪUIۤɬפФƤȻפΤǡƤߤޤ
ޤĶñHelloWorldŪʤΤǤŪˤդWindowsץäƤѤʤʡäƴǤ

Rails3Raisl2.x˥ȥ֤̾դ

Rails2.x κϤ褯ϤΥڡ
admin/users
Ȥ
admin/products
ߤ˥ȥ˼ͳ֤̾ĤƤäƤɡ
Rails3ƱȤȤ롼ƥ󥰥顼ܤ롣

Routes.rb򳫤Ƥߤ

namespace :admin do
  resources :products
end


ߤʽΥץ뤬롣
Ǥ⤳äƤRESTFULʻȤǤʤ
Action̾ȤͳˤĤϤɤФΤ

֤̾ʤǰRaisl2.xդˤϡñ˥ǥեȤǥȥȤƤ
#match ':controller(/:action(/:id(.:format)))'
ιԤ褵Ф褫äɡ㤢Ʊͤˤ嵭ν֤̾ǤäƤФΤʡ

namespace :admin do
  match ':controller(/:action(/:id(.:format)))'
end


󡢤

ǡ

match ':controller(/:action(/:id(.:format)))', :controller => /admin\/[^\/]+/

ɽб뤳Ȥˡ

¾ˡʤΤ
äƤRESTFuläƤʤˤΡ
̿̾ɲä뤿Ӥ
Routes.rb˵ҲäΤäƤݤȻפΤϻʤǤ礦
new,create,edit,update,destroyʳΥäߤʤȤ¿ɡ

ʤ󤫤ɡ 
ܵRailsASP.Net MVC ǺꤿʤäƤ
 

KindleīСμưۿ

٣ǯ餤RubyȤäƼʬ˥᡼ۿ뤽ʥץȤäΤǤKindle˳Ƥ줿ѤΥ᡼륢ɥ쥹ۿФ褯ʤ äƤȤǤäȲ
Kindleξϥ᡼źեեȤKindle˼ǡʤФʤʤΤǡäȤäơȤcron7:10(7:00Ȥޤ˹Ƥʤ礬ˤ˵ư褦ꡣ

ͭ͡ޤǻ٤ޤ

̣ΤϼƤߤȤȻפޤ
Сб褦ʡ 

 IMG_0481

Ȳ(MIDI)̵GETǤChromeץ GuitarProViewer

Ȳ(MIDI)̵GETǤChromeץ꤬롢ȤȤ®󥹥ȡ뤷Ƥߤޤ

ޤMIDIʤΤǴԤƤϤޤ󤬡ϤʤɤǤ

̾䥢ƥ̾Ǹ뤳ȤǤơXJapanBzǸȤĤäޤ
ޤɤäƤʤɡƤʤɡˡ 

Ȥ櫓ạ̇̄ΤͤϰٻƤߤΤ⤤Ȼפޤ


ץե

Ȥ

C#ɻŻRubyФʳȯԡ
ǶDockerȤؿȤAngularJS˥ϥޤäƤ롣
¢ȤĮȤȤ˽ס

QR
QR
  • 饤֥ɥ֥