1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00
kopano-ol-extension/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Stubs/OutlookWrappers/AppointmentItemWrapper.cs

162 lines
4.3 KiB
C#
Raw Normal View History

2016-12-21 12:53:16 +01:00
/// Copyright 2016 Kopano b.v.
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License, version 3,
/// as published by the Free Software Foundation.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
/// GNU Affero General Public License for more details.
///
/// You should have received a copy of the GNU Affero General Public License
/// along with this program.If not, see<http://www.gnu.org/licenses/>.
///
/// Consult LICENSE file for details
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Acacia.Utils;
2017-02-08 15:40:48 +01:00
using NSOutlook = Microsoft.Office.Interop.Outlook;
2016-12-21 12:53:16 +01:00
namespace Acacia.Stubs.OutlookWrappers
{
2017-02-08 15:40:48 +01:00
class AppointmentItemWrapper : OutlookItemWrapper<NSOutlook.AppointmentItem>, IAppointmentItem, IZPushItem
2016-12-21 12:53:16 +01:00
{
2017-02-08 15:40:48 +01:00
internal AppointmentItemWrapper(NSOutlook.AppointmentItem item)
2016-12-21 12:53:16 +01:00
:
base(item)
{
}
2017-02-08 15:40:48 +01:00
#region IAppointmentItem implementation
2016-12-21 12:53:16 +01:00
public DateTime Start
{
get { return _item.Start; }
set { _item.Start = value; }
}
public DateTime End
{
get { return _item.End; }
set { _item.End = value; }
}
public string Location
{
get { return _item.Location; }
set { _item.Location = value; }
}
2017-02-08 15:40:48 +01:00
#endregion
#region Wrapper methods
protected override NSOutlook.UserProperties GetUserProperties()
2016-12-21 12:53:16 +01:00
{
2017-02-08 15:40:48 +01:00
return _item.UserProperties;
2016-12-21 12:53:16 +01:00
}
2017-02-08 15:40:48 +01:00
protected override NSOutlook.PropertyAccessor GetPropertyAccessor()
2016-12-21 12:53:16 +01:00
{
2017-02-08 15:40:48 +01:00
return _item.PropertyAccessor;
2016-12-21 12:53:16 +01:00
}
2017-02-08 15:40:48 +01:00
public override string ToString()
{
return "Appointment:" + Subject;
}
2016-12-21 12:53:16 +01:00
#endregion
2017-02-08 15:40:48 +01:00
#region IItem implementation
2016-12-21 12:53:16 +01:00
2017-02-08 15:40:48 +01:00
public string Body
2016-12-21 12:53:16 +01:00
{
2017-02-08 15:40:48 +01:00
get { return _item.Body; }
set { _item.Body = value; }
}
public string Subject
{
get { return _item.Subject; }
set { _item.Subject = value; }
2016-12-21 12:53:16 +01:00
}
public void Save() { _item.Save(); }
#endregion
2017-02-08 15:40:48 +01:00
#region IBase implementation
public string EntryId { get { return _item.EntryID; } }
2016-12-21 12:53:16 +01:00
public IFolder Parent
{
2017-02-08 15:40:48 +01:00
get
{
// The wrapper manages the returned folder
return Mapping.Wrap<IFolder>(_item.Parent as NSOutlook.Folder);
}
2016-12-21 12:53:16 +01:00
}
2017-02-08 15:40:48 +01:00
2016-12-21 12:53:16 +01:00
public string ParentEntryId
{
get
{
2017-02-08 15:40:48 +01:00
using (ComRelease com = new ComRelease())
2016-12-21 12:53:16 +01:00
{
2017-02-08 15:40:48 +01:00
NSOutlook.Folder parent = com.Add(_item.Parent);
2016-12-21 12:53:16 +01:00
return parent?.EntryID;
}
2017-02-08 15:40:48 +01:00
}
}
public IStore Store
{
get
{
using (ComRelease com = new ComRelease())
2016-12-21 12:53:16 +01:00
{
2017-02-08 15:40:48 +01:00
NSOutlook.Folder parent = com.Add(_item.Parent);
return StoreWrapper.Wrap(parent?.Store);
2016-12-21 12:53:16 +01:00
}
}
}
2017-02-08 15:40:48 +01:00
public string StoreId
{
get
{
using (ComRelease com = new ComRelease())
{
NSOutlook.Folder parent = com.Add(_item.Parent);
NSOutlook.Store store = com.Add(parent?.Store);
return store.StoreID;
}
}
}
public string StoreDisplayName
{
get
{
using (ComRelease com = new ComRelease())
{
NSOutlook.Folder parent = com.Add(_item.Parent);
NSOutlook.Store store = com.Add(parent?.Store);
return store.StoreID;
}
}
}
public void Delete() { _item.Delete(); }
#endregion
2016-12-21 12:53:16 +01:00
}
}