public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row) { TableRoutingControllerItem i = Items [row]; if (tableColumn.Identifier == "Icon") { if (i.Icon == "in") { return(NSImage.ImageNamed("routes_in.png")); } else { return(NSImage.ImageNamed("routes_out.png")); } } else if (tableColumn.Identifier == "Ip") { return(new NSString(i.Ip)); } else if (tableColumn.Identifier == "Action") { return(new NSString(WindowPreferencesController.RouteDirectionToDescription(i.Action))); } else if (tableColumn.Identifier == "Notes") { return(new NSString(i.Notes)); } else { throw new NotImplementedException(string.Format("{0} is not recognized", tableColumn.Identifier)); } }
public override void AwakeFromNib() { base.AwakeFromNib(); Window.Title = Constants.Name + " - " + Messages.WindowsSettingsRouteTitle; LblHelp.StringValue = Messages.WindowsSettingsRouteTitle; CboAction.RemoveAllItems(); CboAction.AddItem(WindowPreferencesController.RouteDirectionToDescription("in")); CboAction.AddItem(WindowPreferencesController.RouteDirectionToDescription("out")); TxtIP.Changed += (object sender, EventArgs e) => { EnableIde(); }; CmdOk.Activated += (object sender, EventArgs e) => { Accepted = true; Item.Ip = TxtIP.StringValue; Item.Action = WindowPreferencesController.RouteDescriptionToDirection(GuiUtils.GetSelected(CboAction)); Item.Icon = Item.Action; Item.Notes = TxtNotes.StringValue; Window.Close(); NSApplication.SharedApplication.StopModal(); }; CmdCancel.Activated += (object sender, EventArgs e) => { Accepted = false; Window.Close(); NSApplication.SharedApplication.StopModal(); }; TxtIP.StringValue = Item.Ip; GuiUtils.SetSelected(CboAction, WindowPreferencesController.RouteDirectionToDescription(Item.Action)); TxtNotes.StringValue = Item.Notes; EnableIde(); }