我要求foreach在每个屏幕上都找到多屏设置上的主屏幕,然后我尝试设置一个列表以供其他用途来设置单独的壁纸,例如wallpaper1-3是假的,而wallpaper 4是真实的主屏幕>
//到目前为止,这就是我的工作,并且有效
onCreate((snapshot,context)=>{...} // works fine
onWrite((snapshot,context)=>{...} // did not work
使用System.Runtime.InteropServices; 使用System.Windows.Forms;
命名空间SetDesktopBackground { 静态类程序 { [DllImport(“ user32.dll”,CharSet = CharSet.Auto)] 私有静态外部int SystemParametersInfo(int uAction, int uParam,字符串lpvParam,int fuWinIni);
// Take the text parameter passed to this HTTP endpoint and insert it into the
// Realtime Database under the path /log/:pushId/original
// <host>/pushLog?text=
exports.pushLog=functions.https
.onRequest(async(req,res)=>{
// Grab the text parameter.
const original = req.query.text;
// Push the new log into the Realtime Database using the Firebase Admin SDK.
const snapshot = await admin.database().ref('/log').push({original: original});
res.status(200).send(
`<!doctype html><head><title>pushLog</title></head><body>
<a href="${snapshot.ref.toString()}" target="_blank">${original} was saved</a>
</body></html>`
);
});
// Listens for new log added to /log/:pushId/original and creates an
// uppercase version of the log to /log/:pushId/uppercase
exports.db_uppercaseLog=functions.database
.ref('/log/{pushId}/original')
.onWrite((snapshot,context)=>{
// Grab the current value of what was written to the Realtime Database.
const original = snapshot.val();
const uppercase = original.toUpperCase();
// You must return a Promise when performing asynchronous tasks inside a Functions such as
// writing to the Firebase Realtime Database.
// Setting an "uppercase" sibling in the Realtime Database returns a Promise.
return snapshot.ref.parent.child('uppercase').set(uppercase);
});
}
//这是控制台中的结果
屏幕\。\ DISPLAY1 初级错误 墙纸1 屏幕\。\ DISPLAY2 初级错误 Wallpaper2 屏幕\。\ DISPLAY3 原真 墙纸3 屏幕\。\ DISPLAY4 初级错误 Wallpaper4
但我想将输出Wallpaper(number)用于其他工作,但我不知道如何使用它,例如 错误清单 墙纸1 Wallpaper2 Wallpaper4
真实列表 Wallpaper3