Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added DismissedAction to ActionSheet

misc fixes
  • Loading branch information...
commit 182e3f38919d83adacaec994d0d4c6ea3905e036 1 parent 9da1ee9
@RobertKozak authored
View
95 Application/UrlImageStore.cs
@@ -12,102 +12,7 @@
// code based on Redth's UrlImageStore, but not using the not very stable NSOperationQueue under MonoTouch but rather
// the Parallels taks library
// original one: https://gist.github.com/405923
-
-/* usage as follows
-
- public class ImageManager : IUrlImageUpdated
- {
- public delegate void ImageLoadedDelegate(string id, UIImage image);
- public event ImageLoadedDelegate ImageLoaded;
-
- UrlImageStore imageStore;
-
- private ImageManager()
- {
- imageStore = new UrlImageStore ("myImageStore", processImage);
- }
-
- private static ImageManager instance;
-
- public static ImageManager Instance
- {
- get
- {
- if (instance == null)
- instance = new ImageManager ();
-
- return instance;
- }
- }
-
- // this is the actual entrypoint you call
- public UIImage GetImage(string imageUrl)
- {
- return imageStore.RequestImage (imageUrl, imageUrl, this);
- }
-
- public void UrlImageUpdated (string id, UIImage image)
- {
- // just propagate to upper level
- if (this.ImageLoaded != null)
- this.ImageLoaded(id, image);
- }
-
- // This handles our ProcessImageDelegate
- // just a simple way for us to be able to do whatever we want to our image
- // before it gets cached, so here's where you want to resize, etc.
- UIImage processImage(string id, UIImage image)
- {
- return image;
- }
- }
-
- public class MyUIViewController : UIViewController
- {
- // in some UIViewController simply request the image from the manager and register for the callback delegate to update then
- // so lets assume we have view controller and it contains imageView instance of UIImageView
- public override ViewDidLoad ()
- {
- // get the image by some URL
- UIImage image = ImageManager.Instance.GetProductImage (_imageUrl);
-
- if (image == null) // it is not available cached, so we will wait for it
- {
- // register for callback
- ImageManager.Instance.ImageLoaded += HandleImageManagerInstanceImageLoaded;
- }
- else
- {
- // it exists so show it here
- if (imageView != null)
- imageView.Image = image;
-
- if (activityIndicator != null)
- activityIndicator.StopAnimating();
- }
- }
-
- void HandleImageManagerInstanceImageLoaded (string id, UIImage image)
- {
- if (id == _imageUrl)
- {
- // deregister the handler
- ImageManager.Instance.ImageLoaded -= HandleImageManagerInstanceImageLoaded;
-
- this.InvokeOnMainThread (delegate {
-
- if (_imageView != null)
- _imageView.Image = image;
-
- if (_activityIndicator != null)
- _activityIndicator.StopAnimating();
- });
- }
- }
- }
-* */
-
namespace MonoTouch.UrlImageStore
{
public interface IUrlImageUpdated
View
5 Dialog/CellViews/Base/ObjectCellView.cs
@@ -66,6 +66,9 @@ public override void UpdateCell(UITableViewCell cell, NSIndexPath indexPath)
public virtual void Selected(DialogViewController controller, UITableView tableView, object item, NSIndexPath indexPath)
{
+ if (NavigateToViewType == null)
+ return;
+
var dataContext = DataContext.Value;
if (dataContext == null)
@@ -76,7 +79,7 @@ public virtual void Selected(DialogViewController controller, UITableView tableV
if (dataContext != null)
{
var view = dataContext;
- if (NavigateToViewType != null && !view.GetType().Equals(NavigateToViewType))
+ if (!view.GetType().Equals(NavigateToViewType))
{
view = ViewCreator.Create(NavigateToViewType, dataContext);
}
View
2  Dialog/DialogViewController/ViewSource.cs
@@ -235,6 +235,8 @@ public override void WillDisplay(UITableView tableView, UITableViewCell cell, NS
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
+ tableView.DeselectRow(indexPath, true);
+
MemberData memberData = null;
var listIndexPath = NSIndexPath.FromRowSection(0, indexPath.Section);
View
2  Dialog/ViewParser.cs
@@ -345,6 +345,8 @@ public static UITableViewSource ParseList(DialogViewController controller, Membe
{
source.IsSelectable = false;
source.NavigationViewType = navigable.NavigateToViewType;
+
+ source.IsNavigable = navigable.NavigateToViewType != null;
}
}
View
12 View/ActionSheetView.cs
@@ -42,6 +42,13 @@ public class ActionSheetView : UIActionSheet
protected Dictionary<int, ICommand> CommandMap = new Dictionary<int, ICommand>();
+ private Action _DismissedAction;
+ public Action DismissedAction
+ {
+ get { return _DismissedAction; }
+ set { _DismissedAction = value; }
+ }
+
//Descendents cannot have a parameterless constructor. // Bug in MonoTouch? iOS?
public ActionSheetView(string title) : base(title)
{
@@ -97,6 +104,11 @@ private void HandleDismissed(object sender, UIButtonEventArgs e)
{
CommandMap[e.ButtonIndex].Execute(e.ButtonIndex);
DismissWithClickedButtonIndex(e.ButtonIndex, false);
+
+ if (DismissedAction != null)
+ {
+ DismissedAction();
+ }
}
public virtual void Cancel()
Please sign in to comment.
Something went wrong with that request. Please try again.