in code/src/UI/Services/ProjectConfigInfoService.cs [345:392]
private bool IsCodeBehind(string platform)
{
switch (platform)
{
case Platforms.Uwp:
if (IsCSharpProject())
{
if (ExistsFileInProjectPath("ActivationService.cs", "Services"))
{
var codebehindFile = Directory.GetFiles(Path.Combine(_shell.Project.GetActiveProjectPath(), "Views"), "*.xaml.cs", SearchOption.TopDirectoryOnly).FirstOrDefault();
if (!string.IsNullOrEmpty(codebehindFile))
{
var fileContent = File.ReadAllText(codebehindFile);
return fileContent.Contains("INotifyPropertyChanged")
&& fileContent.Contains("public event PropertyChangedEventHandler PropertyChanged;");
}
}
}
if (ExistsFileInProjectPath("ActivationService.vb", "Services"))
{
var codebehindFile = Directory.GetFiles(Path.Combine(_shell.Project.GetActiveProjectPath(), "Views"), "*.xaml.vb", SearchOption.TopDirectoryOnly).FirstOrDefault();
if (!string.IsNullOrEmpty(codebehindFile))
{
var fileContent = File.ReadAllText(codebehindFile);
return fileContent.Contains("INotifyPropertyChanged") &&
fileContent.Contains("Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged");
}
}
return false;
case Platforms.Wpf:
if (ExistsFileInProjectPath("ApplicationHostService.cs", "Services"))
{
var codebehindFile = Directory.GetFiles(Path.Combine(_shell.Project.GetActiveProjectPath(), "Views"), "*.xaml.cs", SearchOption.TopDirectoryOnly).FirstOrDefault();
if (!string.IsNullOrEmpty(codebehindFile))
{
var fileContent = File.ReadAllText(codebehindFile);
return fileContent.Contains("INotifyPropertyChanged")
&& fileContent.Contains("public event PropertyChangedEventHandler PropertyChanged;");
}
}
return false;
default:
return false;
}
}