Developing Libraries of one's own

Amalkotey

Active Member
Licensed User
Longtime User
Hello,

as I had to state, the contact entry of Outlook does not turn into the ring tone field encapsulatedly. I have found the source code in the forum for the Outlook.dll now.

I would like the class contact around this field now/enlarge members. Which C # compilers have I to use and IDE?

Many thanks for yours information in advance.

Yours sincerely
Amalkotey
 

Amalkotey

Active Member
Licensed User
Longtime User
hi,

the outlook.dll is component of Basic4PPC 6.50. Erel has published the source code of this Librarie in this. Sorry, the thread finds me in momanret no more.

best regards!
 

agraham

Expert
Licensed User
Longtime User
Which C # compilers have I to use and IDE?
You will need either Visual Studio 2005 Standard (which I use) or Visual Studio 2008 Professional to be able to compile for the device. These cost money :(

You could use SharpDevelop SharpDevelop @ic#code which is free - you also need some SDKs from Microsoft but they are free to download. I haven't used this but some others here have I believe.

Edit: I should also point out that if you want to forego the use of an IDE you can write your code in the editor of your choice and compile manually with the C# compiler that is installed on any desktop running .NET 2.0 (this is what Basic4ppc uses for optimised compilation). To compile for the device you need the Compact Framework installed on the desktop. However creating the correct response file and command line can be "interesting" if you take this approach.
 
Last edited:

Amalkotey

Active Member
Licensed User
Longtime User
@agraham:

the costs are not the problem since I am working as a freelance software developer. I have installed both Visual studio 2008 and SharpDevelop 3.0 have.
Visual studio stops the construction because it the following Namenspates not findest:

B4X:
using Microsoft.WindowsMobile.PocketOutlook; 
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception; 
using System.Drawing;

where can I find these?

best regards
Amalkotey
 
Last edited:

agraham

Expert
Licensed User
Longtime User
You need to install the WM5.0 SDK from Microsoft and they are then found in the Program File\Windows CE Tools\wce500\Windows Mobile 5.0 pocket PC SDk\Designtimereferences folder.

However a new SmartDevice template should now be available for WM 5.0 projects in Visual Studio, called "ppc" on my system, that has the new WindowsMobile libraries already added to the .NET tab in the AddReference dialog.

EDIT:- System.Drawing should already be available in the AddReference dialog.
 

Amalkotey

Active Member
Licensed User
Longtime User
Not work

@Agraham:

Everything ok, on the whole works. A following error message is shown making:

Der Typ "Microsoft.WindowsMobile.IApplicationLauncher" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "Microsoft.WindowsMobile, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" hinzu. G:\esdaSO.net\OutlookEx.dll\OutlookEx.dll\OutlookEx.cs

Following the code:

B4X:
private MessageInterceptor mi = new MessageInterceptor();

I always thought, this the variable new is initialized first with the keyword. What is the fault? thanks for your help!

best regards
Amalkotey
 
Last edited:

agraham

Expert
Licensed User
Longtime User
I thought after my last post that as you have Visual Studio 2008 then the WM 5.0 and maybe 6.0 SDKs are probably already installed so you won't need to install them.

The error you have there is that the compiler cannot find the interface IApplicationLauncher which the MessageInterceptor class inherits. It is telling you to add a reference to Microsoft.WindowsMobile which is where IApplicationLauncher is defined.
 

Amalkotey

Active Member
Licensed User
Longtime User
Problem

Hello Agraham,

thank you for your help! On the whole everything works faultlessly. I could make the OutlookEx.dll. I have written a demo variably to test the dll. I get an error message in Basic4PPC V6.50. I have the same programme into loaded the beta 6.78, and read there the programme make itself. What is this due to?

best regards
Amalkotey
 

agraham

Expert
Licensed User
Longtime User
OutlookExe_Demo.sbp optimise compiles OK for me under version 6.50 and OutlookExe_Demo 6.78-IDE.sbp optimise compiles OK for me under version 6.80. The error you are showing says that the Contact Object does not include a Ringtone member which normally would indicate a problem with the dll (or the source if you are merging it from the Libraries folder) but what you posted all works fine for me :confused:
 

Amalkotey

Active Member
Licensed User
Longtime User
@Agraham:

I have installed Basic4PPC newly so. The dll works now. I will publish the OutlookEx.dll for everyone. Again thanks for your help.

best regards
Amalkotey
 

Amalkotey

Active Member
Licensed User
Longtime User
@AGraham:

The fault is not due to the IDE. I have noticed you make then correctly, if I delete the file OutlookEx.cs. I have added the namensspace "Microsoft.Windows.Mobile" again and the fault nevertheless comes. So it must lie to the dll. Do you have an idea?

B4X:
/*******************************************************************************************
 * Project : esdaS©'s OutlookEx Librarie for Basic4PPC                                     *
 * DLL-Name: OutlookEx.dll                                                                 *
 * Unit    : OutlookEx.cs - Librarie                                                       *
 * Compiler: Visual Studio 2008 Professional                                               *
 * Datum   : 09.06.2009                                                                    *
 * durch   : BNG                                                                           *
 *                                                                                         *
 *  © by Anywhere Software Erel Uziel, Israel - http://www.b4x.com                   *
 *  © the expansions by esdaS© - ESPRIT DATA SOFTWARE, Germany - http://www.esdaso.de      *
 *  Author: Bodo-Norbert Göldner - [email protected]                                      *
 *                                                                                         *
 * ****V3.30.*******************************************************************************/

//ref: Microsoft.WindowsMobile.PocketOutlook.dll
//ref: Microsoft.WindowsMobile.dll
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.WindowsMobile;
using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
using System.Globalization;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;

namespace Email
{
   public class EmailSender : IDisposable
   {
      public static OutlookSession session = null;
      public double DLLVersion
      {
         get { return 3.3; }
      }
      static EmailSender()
      {
         session = new OutlookSession();
      }
      public EmailSender()
      {
      }
      public string[] GetAccounts()
      {
         string[] list = new string[session.EmailAccounts.Count];
         int i = 0;
         foreach (EmailAccount ea in session.EmailAccounts)
         {
            list[i] = ea.Name;
            i++;
         }
         return list;
      }
      public void Send(System.Windows.Forms.Control Form, string Account, object Message)
      {
         session.EmailAccounts[Account].Send((EmailMessage)Message);
         MessagingApplication.Synchronize(Account);
         ((System.Windows.Forms.Form)Form).Activate();
      }

      public void Dispose()
      {
         if (session != null)
            session.Dispose();
      }
   }

   public class Message
   {
      private EmailMessage em = null;
      public Message()
      {
         em = new EmailMessage();
      }
      public void AddTo(string Address)
      {
         em.To.Add(new Recipient(Address));
      }
      public void AddCC(string Address)
      {
         em.CC.Add(new Recipient(Address));
      }
      public string BodyText
      {
         get { return em.BodyText; }
         set { em.BodyText = value; }
      }
      public string Subject
      {
         get { return em.Subject; }
         set { em.Subject = value; }
      }
      public void AddAttachment(string File)
      {
         em.Attachments.Add(new Attachment(File));
      }
      public object Value
      {
         get { return em; }
         set { em = (EmailMessage)value; }
      }

   }
   public class PimCollection
   {
      PimItemCollection cl;
      PropertyDescriptorCollection pc;
      CultureInfo cul = new CultureInfo("en-US", false);
      public PimCollection(string Type)
      {
         switch (Type.ToLower())
         {
            case "contacts":
               {
                  cl = EmailSender.session.Contacts.Items;
                  pc = TypeDescriptor.GetProperties(typeof(Microsoft.WindowsMobile.PocketOutlook.Contact));
                  break;
               }
            case "tasks":
               {
                  cl = EmailSender.session.Tasks.Items;
                  pc = TypeDescriptor.GetProperties(typeof(Microsoft.WindowsMobile.PocketOutlook.Task));
                  break;
               }
            case "appointments":
               {
                  cl = EmailSender.session.Appointments.Items;
                  pc = TypeDescriptor.GetProperties(typeof(Microsoft.WindowsMobile.PocketOutlook.Appointment));
                  break;
               }
            default:
               throw new Exception("Type value must be one of the following:\nContacts, Tasks or Appointments.");
         }
      }
      public int Count
      {
         get { return cl.Count; }
      }
      public object GetItem(int Index)
      {
         return cl[Index];
      }
      public void RemoveItem(int Index)
      {
         cl.RemoveAt(Index);
      }
      public void SortItems(string Property, bool Descending)
      {
         cl.Sort(Property, Descending);
      }
      public int AddItem(object Item)
      {
         return cl.Add((PimItem)Item);
      }
      public int FindItem(string Property, string Value)
      {
         PropertyDescriptor p = pc.Find(Property, true);
         if (p == null)
            throw new Exception("Invalid property.");
         Type t = p.PropertyType;
         if (t == typeof(string))
            return cl.Find(p, Value);
         else if (t == typeof(DateTime))
         {
            long l = long.Parse(Value, NumberStyles.Integer, cul);
            return cl.Find(p, new DateTime(l));
         }
         else if (t == typeof(Uri))
         {
            return cl.Find(p, new Uri(Value));
         }
         else
            return -1;
      }
   }

   public class Contact
   {
      Microsoft.WindowsMobile.PocketOutlook.Contact ct;
      public Contact()
      { }
      public object Value
      {
         get { return ct; }
         set { ct = (Microsoft.WindowsMobile.PocketOutlook.Contact)value; }
      }
      public void CreateNew()
      {
         ct = new Microsoft.WindowsMobile.PocketOutlook.Contact();
      }
      public void Update()
      {
         ct.Update();
      }
      public Image GetPicture()
      {
         return ct.Picture;
      }
      public void SetPicture(string FileName)
      {
         ct.SetPicture(FileName);
      }

      public string AccountName { get { return ct.AccountName; } set { ct.AccountName = value; } }
      public string AssistantName { get { return ct.AssistantName; } set { ct.AssistantName = value; } }
      public long Anniversary { get { return ct.Anniversary.Ticks; } set { ct.Anniversary = new DateTime(value); } }
      public long Birthday { get { return ct.Birthday.Ticks; } set { ct.Birthday = new DateTime(value); } }      
      public string AssistantTelephoneNumber { get { return ct.AssistantTelephoneNumber; } set { ct.AssistantTelephoneNumber = value; } }
      public string Body { get { return ct.Body; } set { ct.Body = value; } }
      public string BusinessAddressCity { get { return ct.BusinessAddressCity; } set { ct.BusinessAddressCity = value; } }
      public string BusinessAddressCountry { get { return ct.BusinessAddressCountry; } set { ct.BusinessAddressCountry = value; } }
      public string BusinessAddressPostalCode { get { return ct.BusinessAddressPostalCode; } set { ct.BusinessAddressPostalCode = value; } }
      public string BusinessAddressState { get { return ct.BusinessAddressState; } set { ct.BusinessAddressState = value; } }
      public string BusinessAddressStreet { get { return ct.BusinessAddressStreet; } set { ct.BusinessAddressStreet = value; } }
      public string BusinessFaxNumber { get { return ct.BusinessFaxNumber; } set { ct.BusinessFaxNumber = value; } }
      public string BusinessTelephoneNumber { get { return ct.BusinessTelephoneNumber; } set { ct.BusinessTelephoneNumber = value; } }
      public string CarTelephoneNumber { get { return ct.CarTelephoneNumber; } set { ct.CarTelephoneNumber = value; } }
      public string Categories { get { return ct.Categories; } set { ct.Categories = value; } }
      public string Children { get { return ct.Children; } set { ct.Children = value; } }
      public string CompanyName { get { return ct.CompanyName; } set { ct.CompanyName = value; } }
      public string CompanyTelephoneNumber { get { return ct.CompanyTelephoneNumber; } set { ct.CompanyTelephoneNumber = value; } }
      public string Department { get { return ct.Department; } set { ct.Department = value; } }
      public string Email1Address { get { return ct.Email1Address; } set { ct.Email1Address = value; } }
      public string Email2Address { get { return ct.Email2Address; } set { ct.Email2Address = value; } }
      public string Email3Address { get { return ct.Email3Address; } set { ct.Email3Address = value; } }
      public string FileAs { get { return ct.FileAs; } set { ct.FileAs = value; } }
      public string FirstName { get { return ct.FirstName; } set { ct.FirstName = value; } }
      public string GovernmentId { get { return ct.GovernmentId; } set { ct.GovernmentId = value; } }
      public string Home2TelephoneNumber { get { return ct.Home2TelephoneNumber; } set { ct.Home2TelephoneNumber = value; } }
      public string HomeAddressCity { get { return ct.HomeAddressCity; } set { ct.HomeAddressCity = value; } }
      public string HomeAddressCountry { get { return ct.HomeAddressCountry; } set { ct.HomeAddressCountry = value; } }
      public string HomeAddressPostalCode { get { return ct.HomeAddressPostalCode; } set { ct.HomeAddressPostalCode = value; } }
      public string HomeAddressState { get { return ct.HomeAddressState; } set { ct.HomeAddressState = value; } }
      public string HomeAddressStreet { get { return ct.HomeAddressStreet; } set { ct.HomeAddressStreet = value; } }
      public string HomeFaxNumber { get { return ct.HomeFaxNumber; } set { ct.HomeFaxNumber = value; } }
      public string HomeTelephoneNumber { get { return ct.HomeTelephoneNumber; } set { ct.HomeTelephoneNumber = value; } }
      public string IM1Address { get { return ct.IM1Address; } set { ct.IM1Address = value; } }
      public string IM2Address { get { return ct.IM2Address; } set { ct.IM2Address = value; } }
      public string IM3Address { get { return ct.IM3Address; } set { ct.IM3Address = value; } }
      public string JobTitle { get { return ct.JobTitle; } set { ct.JobTitle = value; } }
      public string LastName { get { return ct.LastName; } set { ct.LastName = value; } }
      public string Manager { get { return ct.Manager; } set { ct.Manager = value; } }
      public string MiddleName { get { return ct.MiddleName; } set { ct.MiddleName = value; } }
      public string MobileTelephoneNumber { get { return ct.MobileTelephoneNumber; } set { ct.MobileTelephoneNumber = value; } }
      public string Ringtone { get { return ct.RingTone; } set { ct.RingTone = value; } }
      public string Nickname { get { return ct.Nickname; } set { ct.Nickname = value; } }
      public string OfficeLocation { get { return ct.OfficeLocation; } set { ct.OfficeLocation = value; } }
      public string PagerNumber { get { return ct.PagerNumber; } set { ct.PagerNumber = value; } }
      public string Spouse { get { return ct.Spouse; } set { ct.Spouse = value; } }
      public string Suffix { get { return ct.Suffix; } set { ct.Suffix = value; } }
      public string Title { get { return ct.Title; } set { ct.Title = value; } }
      public string WebPage { get { return ct.WebPage.ToString(); } set { ct.WebPage = new Uri(value); } }
   }

   public class Task
   {
      Microsoft.WindowsMobile.PocketOutlook.Task ct;
      public Task()
      { }
      public object Value
      {
         get { return ct; }
         set { ct = (Microsoft.WindowsMobile.PocketOutlook.Task)value; }
      }
      public void CreateNew()
      {
         ct = new Microsoft.WindowsMobile.PocketOutlook.Task();
      }
      public void Update()
      {
         ct.Update();
      }
      public string Body { get { return ct.Body; } set { ct.Body = value; } }
      public string Categories { get { return ct.Categories; } set { ct.Categories = value; } }
      public string ReminderSoundFile { get { return ct.ReminderSoundFile; } set { ct.ReminderSoundFile = value; } }
      public string Subject { get { return ct.Subject; } set { ct.Subject = value; } }
      public bool Complete { get { return ct.Complete; } set { ct.Complete = value; } }
      public bool ReminderDialog { get { return ct.ReminderDialog; } set { ct.ReminderDialog = value; } }
      public bool ReminderLed { get { return ct.ReminderLed; } set { ct.ReminderLed = value; } }
      public bool ReminderSet { get { return ct.ReminderSet; } set { ct.ReminderSet = value; } }
      public bool ReminderSound { get { return ct.ReminderSound; } set { ct.ReminderSound = value; } }
      public bool TeamTask { get { return ct.TeamTask; } set { ct.TeamTask = value; } }
      public long DateCompleted { get { return ct.DateCompleted.Ticks; } }
      public long DueDate { get { return ct.DueDate.Ticks; } set { ct.DueDate = new DateTime(value); } }
      public long StartDate { get { return ct.StartDate.Ticks; } set { ct.StartDate = new DateTime(value); } }
      public int Importance { get { return (int)ct.Importance; } set { ct.Importance = (Importance)value; } }
   }

   public class Appointment
   {
      Microsoft.WindowsMobile.PocketOutlook.Appointment ct;
      public Appointment()
      { }
      public object Value
      {
         get { return ct; }
         set { ct = (Microsoft.WindowsMobile.PocketOutlook.Appointment)value; }
      }
      public void CreateNew()
      {
         ct = new Microsoft.WindowsMobile.PocketOutlook.Appointment();
      }
      public void Update()
      {
         ct.Update();
      }

      public bool AllDayEvent { get { return ct.AllDayEvent; } set { ct.AllDayEvent = value; } }
      public string Body { get { return ct.Body; } set { ct.Body = value; } }
      public string Categories { get { return ct.Categories; } set { ct.Categories = value; } }
      public int Duration { get { return (int)(ct.Duration.Ticks / TimeSpan.TicksPerMinute); } set { ct.Duration = new TimeSpan(0, value, 0); } }
      public long EndTime { get { return ct.End.Ticks; } set { ct.End = new DateTime(value); } }
      public bool IsRecurring { get { return ct.IsRecurring; } }
      public string Location { get { return ct.Location; } set { ct.Location = value; } }
      public bool ReminderDialog { get { return ct.ReminderDialog; } set { ct.ReminderDialog = value; } }
      public bool ReminderLed { get { return ct.ReminderLed; } set { ct.ReminderLed = value; } }
      public int ReminderMinutesBeforeStart { get { return ct.ReminderMinutesBeforeStart; } set { ct.ReminderMinutesBeforeStart = value; } }
      public bool ReminderRepeat { get { return ct.ReminderRepeat; } set { ct.ReminderRepeat = value; } }
      public bool ReminderSet { get { return ct.ReminderSet; } set { ct.ReminderSet = value; } }
      public bool ReminderSound { get { return ct.ReminderSound; } set { ct.ReminderSound = value; } }
      public string ReminderSoundFile { get { return ct.ReminderSoundFile; } set { ct.ReminderSoundFile = value; } }
      public bool ReminderVibrate { get { return ct.ReminderVibrate; } set { ct.ReminderVibrate = value; } }
      public long Start { get { return ct.Start.Ticks; } set { ct.Start = new DateTime(value); } }
      public string Subject { get { return ct.Subject; } set { ct.Subject = value; } }
   }

   public class SMSMessage
   {
      private SmsMessage s = null;

      public string Body
      {
         get { return s.Body; }
      }
      public object Value
      {
         get { return s; }
         set { s = (SmsMessage)value; }
      }
      public string From
      {
         get { return s.From.Address; }
      }
      public long DateReceived
      {
         get { return s.Received.Ticks; }
      }

      public SMSMessage(string PhoneNumber, string Text)
      {
         s = new SmsMessage(PhoneNumber, Text);
         s.Send();
      }
      public SMSMessage()
      { }
   }

   public class SMSInterceptor : IDisposable
   {
      private object[] eventObject;
      public event EventHandler MessageReceived;
      private MessageInterceptor mi = new MessageInterceptor();
      public object ReceivedMessage = null;
      public SMSInterceptor()
      {
         eventObject = new object[] { this, "MessageReceived" };
         mi.MessageReceived += new MessageInterceptorEventHandler(mi_MessageReceived);
      }

      void mi_MessageReceived(object sender, MessageInterceptorEventArgs e)
      {
         if (MessageReceived != null)
         {
            ReceivedMessage = (SmsMessage)e.Message;
            MessageReceived(eventObject, null);
         }
      }

      void IDisposable.Dispose()
      {
         if (mi != null)
            mi.Dispose();
         MessageReceived = null;

      }
   }
}

Best regards
Amalkotey
 
Last edited:

Amalkotey

Active Member
Licensed User
Longtime User
@Agraham:

Please excuse my bad one English. Yes, I have both OutlookEx.dll and the OutlookEx.cs into the Librarie list copied. I remove the CS file, the programme is made correctly.
 

agraham

Expert
Licensed User
Longtime User
The problem is one of references. Basic4ppc doesn't know that OutlookEx.cs needs references to Microsoft.Windows.Mobile.dll and Microsoft.WindowsMobile.PocketOutlook.dll to compile. These libraries are extra to the .NET 2.0 Compact Framework standard libraries, being part of the WM 5.0 SDK, and are not in the same place so Basic4ppc can't find them. This is partly why Erel does not include Outlook.cs with Basic4ppc.

The other, real, reason for Erel not including Outlook.cs is that only developers will have the WM 5.0 SDK with these dlls available so Outlook.cs won't compile on most systems as the required dlls are missing.

So just post the dll itself and forget about the source.
 

Amalkotey

Active Member
Licensed User
Longtime User
@Agraham:

Thank you for the information. I have removed the source code now.

Best regards
Amalkotey
 
Top