private void ChangeDidEnd(NSOpenPanel aPanel, int aReturnCode, IntPtr aContextInfo) { if (aReturnCode == NSOpenPanel.NSOKButton) { if (aPanel == null) { UserLog.WriteLine(string.Format("{0}: Logging for #795 aPanel is null ({1}, {2})", DateTime.Now, iOption.Name, iOption.Value)); } if (aPanel.Directory == null) { NSURL url = aPanel.SendMessage <NSURL>("directoryURL"); UserLog.WriteLine(string.Format("{0}: Logging for #795 directory is null ({1}, {2})", DateTime.Now, iOption.Name, iOption.Value)); UserLog.WriteLine(string.Format("{0}: Logging for #795 directoryURL ({1})", DateTime.Now, (url != null) ? url.ToString() : "null")); UserLog.WriteLine(string.Format("{0}: Logging for #795 URLs count ({1})", DateTime.Now, aPanel.URLs.Count)); for (uint i = 0; i < aPanel.URLs.Count; i++) { url = aPanel.URLs[(int)i].SafeCastAs <NSURL>(); UserLog.WriteLine(string.Format("{0}: Logging for #795 URLs[{1}] ({2})", DateTime.Now, i, (url != null) ? url.ToString() : "null")); } } if (aPanel.Directory != null) { Add(aPanel.Directory.ToString()); } else if (aPanel.URLs.Count > 0) //#795: root unc share comes through with null Directory { NSURL url = aPanel.URLs[0].SafeCastAs <NSURL>(); Add(url.SendMessage <NSString>("path").ToString()); } } }
private void ChangeDidEnd(NSOpenPanel aPanel, int aReturnCode, IntPtr aContextInfo) { if (aReturnCode == NSOpenPanel.NSOKButton) { if (aPanel == null) { UserLog.WriteLine(string.Format("{0}: Logging for #795 aPanel is null ({1}, {2})", DateTime.Now, iOption.Name, iOption.Value)); } if (aPanel.Filename == null) { NSURL url = aPanel.SendMessage <NSURL>("URL"); UserLog.WriteLine(string.Format("{0}: Logging for #795 Filename is null ({1}, {2})", DateTime.Now, iOption.Name, iOption.Value)); UserLog.WriteLine(string.Format("{0}: Logging for #795 URL ({1})", DateTime.Now, (url != null) ? url.ToString() : "null")); UserLog.WriteLine(string.Format("{0}: Logging for #795 URLs count ({1})", DateTime.Now, aPanel.URLs.Count)); for (uint i = 0; i < aPanel.URLs.Count; i++) { url = aPanel.URLs[(int)i].SafeCastAs <NSURL>(); UserLog.WriteLine(string.Format("{0}: Logging for #795 URLs[{1}] ({2})", DateTime.Now, i, (url != null) ? url.ToString() : "null")); } } if (aPanel.Filename != null) { iOption.Set(aPanel.Filename.ToString()); } else if (aPanel.URLs.Count > 0) //#795: root unc share comes through with null Directory, not sure whether this can happen with filename property too, so have put this in for safety. { NSURL url = aPanel.URLs[0].SafeCastAs <NSURL>(); iOption.Set(url.SendMessage <NSString>("path").ToString()); } } }