public static bool TryParse(string value, out AppWindowProperties props) { props = default(AppWindowProperties); if (string.IsNullOrEmpty(value) || !value.StartsWith(Prefix)) { return(false); } props = StructConverter.FromString <AppWindowProperties>(value.Substring(8)); return(true); }
private bool TryGetPosition(out WINDOWPLACEMENT placement) { try { placement = default(WINDOWPLACEMENT); using (var reader = new StreamReader(new IsolatedStorageFileStream(_storageFilePath, FileMode.OpenOrCreate, _store))) { var str = reader.ReadToEnd(); if (!string.IsNullOrEmpty(str)) { placement = StructConverter.FromString <WINDOWPLACEMENT>(str); return(true); } return(false); } } catch (Exception e) { Logger.Error("Error reading saved window position", e); placement = default(WINDOWPLACEMENT); return(false); } }