小编Ahm*_*adi的帖子

Exchange Web服务:为什么ItemId不是常量?[继续]

正如其他一些人之前讨论过这个问题(例如,Exchange Web服务:为什么ItemId不是常数?),我想谈谈解决方案,我已经做了人们通过将Guid标记为扩展属性而建议的内容,对我而言解决方案有点好(虽然我不知道如何使其与出现的一起工作)但只要应用程序正常工作,一旦应用程序重新启动项目的扩展属性消失,所以我现在的问题是" 如何在EWS项目上标记扩展属性并使其不断存在?"这是更新日历项目(约会)的代码

public void SetGuidForAppointement(Appointment appointment)
{         
appointment.SetExtendedProperty((ExtendedPropertyDefinition)_appointementIdPropertyDefinition, Guid.NewGuid().ToString());
appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);
}
Run Code Online (Sandbox Code Playgroud)

这些是上面需要的属性定义.

_appointementIdPropertyDefinition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Appointment, "AppointmentID", MapiPropertyType.String);
            _propertyDefinitionBases = new PropertyDefinitionBase[] { _appointementIdPropertyDefinition, ItemSchema.ParentFolderId, AppointmentSchema.Start, AppointmentSchema.End, 
AppointmentSchema.LegacyFreeBusyStatus, AppointmentSchema.Organizer };
            PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, _propertyDefinitionBases);
Run Code Online (Sandbox Code Playgroud)

因此,如果有人在此之前完成此操作,他/她可以向我提供一个示例,即使应用程序退出,也会将扩展属性标记在项目上.谢谢

c# exchangewebservices

9
推荐指数
1
解决办法
3500
查看次数

如何使我的应用程序与智能电视兼容?

你好,我有一个与手机/平板电脑和我的电视Android Box兼容的应用程序.然而,这个应用程序与我的Android智能电视本身不兼容,就像我去谷歌播放(这是阿尔法)我得到的文字说,该应用程序与该设备不兼容.

我做了一些检查,我发现应用程序的清单应该提到这是一个LEANBACK_LAUNCHER,我做了类似下面的代码:

[Activity(Label = "Afaq.IPTV", Icon = "@drawable/icon", MainLauncher = true,
        ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    [IntentFilter(new[] {"android.intent.action.MAIN"}, AutoVerify = true,
        Categories = new[] {"android.intent.category.LEANBACK_LAUNCHER"})]
    public class MainActivity : FormsApplicationActivity
    {...
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?以前有人成功吗?

xamarin.android xamarin xamarin.forms

5
推荐指数
1
解决办法
1247
查看次数

如果记录不存在则更新并添加新记录的方法是否会破坏 SRP?

假设我有一个具有 Update(user) 和 Add(user) 的 DatabaseService 类。我的问题是如何以一种方法同时使用它们。这是一个好习惯吗?更具体地说,它是否违反了单一性规则(即单一责任)?例如,如果我有一个像这样的妈妈

public void AddOrUpdateUser(User user) 
{
   var userFound = GetUserById(user.Id); 
   if (userFound == null) 
   {
      AddUser(user); 
   }
   else
   {
      UpdateUser(user); 
   }
}  
Run Code Online (Sandbox Code Playgroud)

这是个好主意吗?或者它会很糟糕,因为它打破了奇点规则,所以让消费者阶层决定做什么?

c#

0
推荐指数
1
解决办法
146
查看次数