Category Archives: monotouch

Bulk upload to WordPress

Hi everyone,

Got some exciting news! I just got my very first application uploaded and approved on the Apple App store! I’ve been wanting to do something for quite some time but just haven’t been able to figure what I actually want to do.

But, for some time I have been using WordPress to keep track of my daily tasks, projects and general goals as well as using it to post whatever I do in terms of IT and Development. I keep track of a lot of photos on my phone that goes up to WordPress and I always thought the interface from the Phone was clunky. Logging in, Go to Media Library, Adding photos with the extra JS that took place on the phone just didn’t work for me. On top of that all the images were uploaded with a weird rotation.

I figured that this would be nice to have, a small app does nothing but that. I knew WordPress had XMLRPC for managing library (see Annoyed with WordPress) so it shouldn’t be too hard. That being said. I now have my own application uploaded to the app store that does just that.

I used Xamarin as a development platform. I’ve been a fan of Xamarin since it was still monotouch (let’s be honest. Obj-C is no fun).

 

Full page features:

Bulk Upload for WordPress

Some roadmap things

I know there’s more work to be done but the application does what it’s supposed to. Anyways, some things that’ll happen soon:

  • Improve the upload status with images and success/failure messages
  • Multi-site support
  • Use camera to upload (is this even useful?)
  • A nicer looking icon (current one is garbage)
  • More modern iOS design?
  • Share photos into the app from photo library.

Goals of 2011

Haha, just read my old post regarding the goals I had set in 2010. Did any of them come true? – No.

This is how it went:

#1 MonoTouch app
I did start an iPhone application with MonoTouch, but the API for the application is was developing on never got completed so it just died. Would’ve been a great app that’s for sure

#2 Payson drupal module.
Also got started, even got quite far actually, but my leaving of the drupal site I was part of (linuxportalen.se) resulted in a non-complete code. Besides, I have a shallow memory that there were some problems with drupal when it came to directly hook into POST parameters, which were needed by the Payson API. When i think about it I should’ve just made a hacky php that connected to the database with the proper result, but if I’m not mistaken mind was set to do it “the proper” way, which resulted in a no go.

#3 Community site based on Django
Ah, i really loved python back in early 2010, and I still do, but when I did some research I found tornado server of better use, as I started to more and more like to writer proper API’s, instead of views with hooks of code.

I stopped with the Django project after some time, got back to PHP, created a small framework and started developing the new community site, which also kind of died along with my interest in the Swedish Linux community (yeah, it was meant to replace linuxportalen) whom were too much interested of internal conflicts plus distro war.

But, through the year I looked up some different Web frameworks for PHP, and I found DooPHP, a wonderful and fast framework which is easy to learn and use. There’s a small project going on there, without a release date though, just something I do when I’m bored.

So to sum it up, none of my plans happened with the spare time I had part from my ordinary job, but it’s ok, none of them were too important, even though it looked like it when I think back about it.

 

Goals of 2011
Ha ha, right, I won’t set up any goals this year. I spend far too little time in front of the computer when I’m not working and the truth is, there are other things in life far more important to cherish and enjoy besides techie stuff. But hey, do I find something not too big and fun, I’ll probably do it :-).

Take care,
Marcus

2010 – Goals for the year

I didn’t make any new year promise to myself. Mostly because there’s nothing more broken than a promise made when welcoming the new year. So, instead of making promises, I’ve made goals that i’ll try to complete and deliver.

#1 – My first iPhone application released

A couple of months ago I beta tested MonoTouch, the .NET framework for the iPhone. It’s a great tool for all of us who doesn’t want to learn Objective-C. After some testing I started to do some actual work for an application. It still needs  more work to be functional but at least I have something to go on. I all goes well this will be done somewhat in April.

#2 – Payson Drupal Module

This one is a bit disturbing and embarrasing. For a long time I’ve wanted to make this module for Drupal where you, as a user have the possibility to sponsor sites by paying a small amount of cash using paysons money transaction system. I like Payson, and it really deserves more focus :). Hopefulle this will come handy to Drupal site administrators. Hopefully this will can be expected in fall of 2010.

#3 – Community Site based on Django

The Swedish Community has for a long time lacked a good community web site for tracking one of the finest things with open source – The great open project that makes whatever disitribution worthy of. It can be all from background search engines like beagle to music players like Listen. All small components that makes the linux experience that great! This should be expected in late 2010.

That’s the three prioritized goals that I have as it is right now. I’ll end this post now to get started :).

See you!
/Marcus

#MonoTouch how to – Drag and Drop Image

My blog posts are commonly in Swedish, but since this might interest users outside the borders of Sweden I decided to write this post in English.

Today, I’ll show how easy it is to Drag an Image around the screen using MonoTouch. Bear with me though, it’s my first how to :).

It’s actually really simple, and you won’t need the Interface Builder.

What we need to do is to create an UIImageView class that overrides the functions TouchesBegan, TouchesMoved and TouchesEnded. It’s looking like this:

	public class myDraggableImage : UIImageView {
		
		//Store locations for remembering the last positions, and counting the future ones.
		PointF Location;
		PointF StartLocation;
		
		bool haveBeenTouchedOnce = false;
				
		public myDraggableImage ( RectangleF frame ){
		
					//Set the position of the frame with RectangleF (Replacement of CGRectangle)
					this.Frame = frame;
					StartLocation = this.Frame.Location;
		}
				
		//This event occurs when you just touch the object
		public override void TouchesBegan (MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
		{
			Console.WriteLine("Touched the object");
			Location = this.Frame.Location;
			
			var touch = (UITouch) e.TouchesForView (this).AnyObject;
			var bounds = Bounds;

			StartLocation = touch.LocationInView(this);
			this.Frame = new RectangleF(Location,bounds.Size);
			
		}
		//This event occurs when you drag it around
		public override void TouchesMoved (MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
		{
			Console.WriteLine("Dragged the object");
			var bounds = Bounds;
			var touch = (UITouch) e.TouchesForView (this).AnyObject;

			//Always refer to the StartLocation of the object that you've been dragging.
			Location.X += touch.LocationInView(this).X - StartLocation.X;
			Location.Y += touch.LocationInView(this).Y - StartLocation.Y;
		
			
			this.Frame = new RectangleF(Location,bounds.Size);
			
			
			haveBeenTouchedOnce = true;
		}
		
		public override void TouchesEnded (MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
		{
			StartLocation = Location;
		}


	}

What’s being done here is that as soon as we Touch the object it will run “TouchesBegan” to start keeping track of the Object. And when we are moving it around, it constantly calls “TouchesMoved” where we are updating the position of the UIImageView on the screen.

When you’ve implemented the class class in your project, all you need to do is to create the object within “public override bool FinishedLaunching”.
It can for instance look like this:

myDraggableImage img = new myDraggableImage(new RectangleF(64,64,64,64));
			img.UserInteractionEnabled = true;
			img.BackgroundColor = UIColor.Green;
			img.Hidden = false;

			window.AddSubview(img);

The result will be a UIImageView that can be dragged around the screen.