compact-framework

How do I continue running after an unhandled exception?

拟墨画扇 提交于 2019-11-27 15:53:06
I have the following code in my application that is running after an unhandled exception: AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var exception = e.ExceptionObject as Exception; if (exception != null) MessageBox.Show(exception.Message + " - " + exception.StackTrace); } but even if i catch unhandled exception my windows mobile application close. How to prevent closing application when i catch unhandled exception. I never want to

C# pinvoke marshalling structure containg vector<structure>

半腔热情 提交于 2019-11-27 15:52:56
I'm in need to call an function that return an structure that contains an int and an vector of other structures in C# for a windows ce 6.0 project: The function is provided by an 3rd party provider (Chinese manufacturer of the pda), and they only delivered me the .h files, the dll and lib. The function i'm trying to call in C# is defined in the .h file as : DLLGSMADAPTER ApnInfoData* GetAvailApnList(); the ApnInfoData structure is as follows: typedef struct ApnInfoData { int m_iDefIndex; ApnInfoArray m_apnList; } typedef struct ApnInfo { DWORD m_dwAuthType; TCHAR m_szName[64]; TCHAR m_szTel[32

Is there a library to read JSON in C# on Windows Mobile? [closed]

放肆的年华 提交于 2019-11-27 15:34:05
I am trying to find a library to parse JSON on C# on Windows Mobile (working with Visual Studio 2005). The libraries that I have found that allow me to parse JSON in C# (litjson and Jayrock) don't work on Windows Mobile, they require classes that are not present in the .NET compact framework. Is there any library that I have overlooked? Or is there another easy way to parse JSON given these circumstances? Json.NET supports the .NET 3.5 compact framework. Have you looked at what the "missing" classes actually have to do for the existing libraries? If they're reasonably simple to implement

In Protobuf-net how can I pass an array of type object with objects of different types inside, knowing the set of potential types in advance

别来无恙 提交于 2019-11-27 14:53:47
I am trying to migrate existing code that uses XmlSerializer to protobuf-net due to the increased performance it offers, however I am having problems with this specific case. I have an object[] that includes parameters that are going to be sent to a remote host (sort of a custom mini rpc facility). I know the set of types from which these parameters can be, but I cannot tell in advance in which order they are going to be sent. I have three constraints. The first is that I am running in Compact Framework, so I need something that works there. Second, as I mentioned performance is a big concern

In C#, how can I serialize System.Exception? (.Net CF 2.0)

牧云@^-^@ 提交于 2019-11-27 13:36:57
I want to write an Exception to an MS Message Queue. When I attempt it I get an exception. So I tried simplifying it by using the XmlSerializer which still raises an exception, but it gave me a bit more info: {"There was an error reflecting type 'System.Exception'."} with InnerException: {"Cannot serialize member System.Exception.Data of type System.Collections.IDictionary, because it implements IDictionary."} Sample Code: Exception e = new Exception("Hello, world!"); MemoryStream stream = new MemoryStream(); XmlSerializer x = new XmlSerializer(e.GetType()); // Exception raised on this line x

Save and Load image SQLite C#

白昼怎懂夜的黑 提交于 2019-11-27 12:00:37
问题 I'm trying to save and load images with SQLite with an app on WinForm with CF. I found a way to save an image into the db but I don't know if it's right because I couldn't find a way to load the image stored in the db. I have a code to convert my image into a Base64: public void ImageToBase64(Image image, System.Drawing.Imaging.ImageFormat format){ using (MemoryStream ms = new MemoryStream()){ // Convert Image to byte[] image.Save(ms, format); byte[] imageBytes = ms.ToArray(); // Convert byte

What are the most valuable .Net Compact Framework Tips, Tricks, and Gotcha-Avoiders? [closed]

落爺英雄遲暮 提交于 2019-11-27 09:56:34
We work extensively in the .Net Compact Framework and Windows Mobile. I've seen plenty of questions come up regarding specifics to development of ASP.Net apps or other .Net based desktop apps but nothing CF specific. Anyone else a mobile developer out there that can share some things to start doing, stop doing, and avoid doing when developing in the Compact Framework? Sure: Use a physical device whenever possible (not the emulator) Test with multiple devices (different vendors, different models) Concentrate testing around sleep/wakeup behaviors When using MSTEST unit tests, never use private

Reading from the serial port in C#

心不动则不痛 提交于 2019-11-27 09:48:22
问题 I have tried using Readline() and data gets dropped, I tried using Read() but I am not sure how to have an error proof method of doing it, since I may get several packets one after another and I have no way of knowing that there is going to be another packet coming in. In between packets BytesToRead is 0, so I can't use it. When reading data to the buffer to you have a timer or put the thread to sleep to allow for all the packets to arrive? I am lost. Don't know what to try next. I should

How best to read a File into List<string>

自古美人都是妖i 提交于 2019-11-27 07:23:05
I am using a list to limit the file size since the target is limited in disk and ram. This is what I am doing now but is there a more efficient way? readonly List<string> LogList = new List<string>(); ... var logFile = File.ReadAllLines(LOG_PATH); foreach (var s in logFile) LogList.Add(s); var logFile = File.ReadAllLines(LOG_PATH); var logList = new List<string>(logFile); Since logFile is an array, you can pass it to the List<T> constructor. This eliminates unnecessary overhead when iterating over the array, or using other IO classes. Actual constructor implementation : public List(IEnumerable

Developing .NET Compact Framework apps in Post-2008 Visual Studio?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 07:00:36
I want to develop a Compact Framework App for a Windows CE 6.0 target device. Can I do this with Visual Studio 2013? If this is not possible, what would be a development environment for .net compact framework? ctacke I'm positive this question is a duplicate, but for the life of me I can't find the original so I'll re-answer here. Microsoft's support for Compact Framework development is not completely obvious or well documented. It's a mixed matrix of the target version of Windows CE, the version of the Compact Framework and the version (and SKU level) of Visual Studio. Generally speaking it