如何在Umbraco 8中上传文件并将其值设置为文件上传数据类型

时间:2019-05-06 08:32:21

标签: umbraco umbraco8

Series.eq是否有一种简单的方法可以将文件上传到控制器级别的Umbraco 8中的媒体文件夹,并将其设置为文件上传数据类型的值。这是我在版本7中使用的代码,它似乎可以正常工作:

private void createNotificationChannel()
    {          
            var channelName = GetString(Resource.String.noti_chan_urgent);
            var channelDescription = GetString(Resource.String.noti_chan_urgent_description);

            // set the vibration patterm for the channel
            long[] vibrationPattern = { 100, 200, 300, 400, 500, 400, 300, 200, 400 };

            // Creating an Audio Attribute
            var alarmAttributes = new AudioAttributes.Builder()
                .SetContentType(AudioContentType.Sonification)
                .SetUsage(AudioUsageKind.Notification).Build();

                // Create the uri for the alarm file                 
            Android.Net.Uri alarmUri = Android.Net.Uri.Parse(${ContentResolver.SchemeAndroidResource}://{Context.PackageName}/{Resource.Raw.soundFile}");


            // create chan1  which is the urgent notifications channel
            var chan1 = new NotificationChannel(PRIMARY_CHANNEL_ID, channelName, NotificationImportance.High)
            {
                Description = channelDescription
            };


            // set the channel properties
            chan1.EnableLights(true);
            chan1.LightColor = Color.Red;
            chan1.SetSound(alarmUri, alarmAttributes);
            chan1.EnableVibration(true);
            chan1.SetVibrationPattern(vibrationPattern);               
            chan1.SetBypassDnd(true);
            chan1.LockscreenVisibility = NotificationVisibility.Public;

            // finally create the notification channel
            var manager = (NotificationManager)GetSystemService(NotificationService);
            manager.CreateNotificationChannel(chan1);
    }

0 个答案:

没有答案