我在xamarin android应用程序中启动了启动屏幕,发生的是启动屏幕始终作为背景出现在其他页面上。
无论我做什么,都在那里。
我试图“完成”该活动,NoHistory = true,但是什么也没有,使后台的其他页面无法显示。
取自 https://alexdunn.org/2017/02/07/creating-a-splash-page-for-xamarin-forms-android/
有什么想法吗?
[Activity(Label = "MyApp",
Theme = "@style/MyTheme.Splash",
Icon = "@drawable/icon",
MainLauncher = true,
NoHistory = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.tabs;
ToolbarResource = Resource.Layout.toolbar;
base.OnCreate(bundle);
Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App(new AndroidInitializer()));
}
}
[Activity(
Theme = "@style/MyTheme.Splash",
MainLauncher = true,
NoHistory = true,
ScreenOrientation = ScreenOrientation.Portrait)]
public class SplashActivity : AppCompatActivity
{
public override void OnCreate(Bundle savedInstanceState, PersistableBundle …Run Code Online (Sandbox Code Playgroud) 在等待新的闪亮HttpClientFactory解决所有问题的同时HttpClient,
我仍然无法找到是否HttpResponseMessage和HttpRequestMessage应该处置的答案。
像下面这样的东西是一种很好的做法吗?
您是否使用 Using 语句HttpResponseMessage?
//httpClient has been injected
using (HttpResponseMessage messageResponse = await httpClient.GetAsync(uri, cancellationToken).ConfigureAwait(false))
{
using (HttpContent content = messageResponse.Content)
{
if (messageResponse.IsSuccessStatusCode)
{
var json = await content.ReadAsStringAsync();
var response = await Task.Run(() => JsonConvert.DeserializeObject<TResponse>(json, serializerSettings));
return new MyWrapperResponse<TResponse>(messageResponse,response);
}
}
}
Run Code Online (Sandbox Code Playgroud) 查看 Xamarin 基本要素并想知道 FileSystem 的目的是什么。
我一直在寻找可以立即为我异步加载和保存文件的东西。
它在我看来,可能是我不理解它给您的唯一功能是保存和加载文件的位置,并且没有实际为您保存它的功能,例如“旧 PCLStorage”
这样对吗?
有人可以澄清 SubModule 如何在 azure devops 中工作
MyDevOps 根文件夹
我有一个名为 MyCore.sln 的解决方案,其中包含 4-5 个项目
我有一个名为 MyMain.sln 的主解决方案,其中包含另外 4-5 个引用 MyCore.sln 项目的项目
这一切都在本地编译和工作,但在 azure devops 中构建时失败
进入powershell中的MyMain.sln文件夹并执行如下
执行如下 git submodule add https://myGroup@dev.azure.com/MyGroup/MyProjec/_git/MyCore
我可以看到 .gitmodules 文件
但是,当我去构建管道时,它找不到引用的项目(属于 myCore 存储库)
我错过了明显的吗?
是否有关于如何在 azure devops 中设置子模块的全面说明?
我可以在任何地方想象这个吗?
如何检测设备是小还是大?我不需要检测是否是平板电脑。
这个概念取自https://devblogs.microsoft.com/xamarin/styling-for-multiple-device-resolutions/
我们使用下面的方法并相应地加载适当的样式,但是因为我没有考虑密度,所以它不准确。
我怎样才能改进或重写这个方法,以便它给我一个更好的结果,并更准确地检测设备是大还是小。
当前的
const int smallWightResolution = 768;
const int smallHeightResolution = 1280;
public static bool IsASmallDevice()
{
// Get Metrics
var mainDisplayInfo = Xamarin.Essentials.DeviceDisplay.MainDisplayInfo;
// Width (in pixels)
var width = mainDisplayInfo.Width;
// Height (in pixels)
var height = mainDisplayInfo.Height;
return (width <= smallWightResolution && height <= smallHeightResolution);
}
Run Code Online (Sandbox Code Playgroud)
尝试使用密度但不知道公式是什么
public static bool IsSmallDevice()
{
//we don't support tablet so tablet don't apply.
int smallWidthResolution = 768;
int smallHeightResolution = 1280;
double screenWidth;
double screenHeight;
bool …Run Code Online (Sandbox Code Playgroud) 我有一组部分类,我想嵌套。
如果我想手动完成,我需要修改什么?过去有一些 Visual Studio 扩展,但不适用于 vs2022
谢谢
更新
假设我有一个名为 MyService.cs 的类,但我想创建像这样的部分类
MyService.AAA.cs MyService.BBB.cs MyService.CCC.cs
我希望它们像下面的图片一样嵌套(只是一个示例)
我需要从 .net core web api 调用旧的 asmx web 服务(我无法控制)
是否可以?
谢谢
将 Prism 用于 xamarin 时,是否可以获取导航堆栈中的当前页面?
我注意到有
PageUtilities.GetCurrentPage(mainPage).
Run Code Online (Sandbox Code Playgroud)
上面的用法是什么?
我正在寻找类似 navigationService.GetCurrentPage() 的东西
非常感谢
我见过很少的网络帖子和解决方案,但似乎没有用。我想念明显的东西吗?这就是我所拥有的
在解决方案级别而不是程序包所在的位置,我有一个文件夹,如下图所示
.tfignore包含以下内容
# Ignore NuGet Packages
*.nupkg
# Ignore the NuGet packages folder in the root of the repository. If needed, prefix 'packages'
# with additional folder names if it's not in the same folder as .tfignore.
packages
# Omit temporary files
project.lock.json
project.assets.json
*.nuget.props
Run Code Online (Sandbox Code Playgroud)
nuget.config.xml包含
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Run Code Online (Sandbox Code Playgroud)
当我尝试在Visual Studio 2017中签入项目时,它仍显示所有包。
有人可以帮我解决我做错的事情吗?
谢谢
我正在尝试编写一个 bash 脚本来更改我的 azure devops 管道的类中的字符串。但无法使其工作。
从https://github.com/Microsoft/appcenter-build-scripts-examples/blob/master/xamarin/app-constants/appcenter-pre-build.sh复制脚本
我的 bash 尝试:
我的班级要改变
namespace Core
{
public class AppConstant
{
public const string ApiUrl = "https://production.com/api";
public const string AnotherOne="AAA";
}
}
Run Code Online (Sandbox Code Playgroud)我的剧本
if [ ! -n "$API_URL" ]
then
echo "You need define the API_URL variable"
exit
fi
APP_CONSTANT_FILE=$(Build.SourcesDirectory)/MyProject/Core/AppConstant.cs
if [ -e "$APP_CONSTANT_FILE" ]
then
echo "Updating ApiUrl to $API_URL in AppConstant.cs"
sed -i '' 's#ApiUrl = "[a-z:./]*"#ApiUrl = "'$API_URL'"#' $APP_CONSTANT_FILE
echo "File content:"
cat …Run Code Online (Sandbox Code Playgroud)