compact-framework

Changing row colors in the Compact Framework DataGrid

倾然丶 夕夏残阳落幕 提交于 2019-11-26 23:24:43
问题 How can I use non-default coloring in the DataGrid control in a Windows CE compact framework application? I need to color one row in color X and one row in color Y (alternating row colors basically). 回答1: You'll have to manually do custom drawing. Ilya on the CF team has a straightforward example of doing it on the team blog here. 来源: https://stackoverflow.com/questions/408113/changing-row-colors-in-the-compact-framework-datagrid

C# Application.Run without Form

只谈情不闲聊 提交于 2019-11-26 21:36:31
问题 Is it possible to call Application.Run, but to not pass a form parameter, or is there an alternative if there’s no form to call? The Run method doesn’t seem to have any overloads that don’t accept a form. For example, if I wanted to instantiate a class first, and then have that call the form, is there way to do the equivalent of: Application.Run(myClass); Just to clarify, I do still want the functionality that .Run() provides. That is, establish a loop to keep the application running, but

Server-generated keys and server-generated values are not supported by SQL Server Compact

谁说胖子不能爱 提交于 2019-11-26 19:57:03
问题 I just started to play with the entity framework, so I decided to connect it to my existing SQL Server CE database. I have a table with an IDENTITY(1, 1) primary key but when I tried to add an entity, I've got the above-mentioned error. From MS Technet artice I learned that SQL Server Compact does not support entities with server-generated keys or values when it is used with the Entity Framework. When using the Entity Framework, an entity’s keys may be marked as server generated. This enables

C# pinvoke marshalling structure containg vector<structure>

淺唱寂寞╮ 提交于 2019-11-26 17:20:04
问题 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;

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-26 16:57:07
问题 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

Is there a BackgroundWorker replacement for .NET Compact Framework 3.5?

北慕城南 提交于 2019-11-26 16:45:51
问题 I want to use something similar to the BackgroundWorker, which is known from the full .NET Framework, on mobile devices. Sadly it is not available in the compact framework. What can I use instead? 回答1: There is an MSDN site discussing the Background Processing Techniques on the CF. The most common option is to use ThreadPool.QueueUserWorkItem instead of a BackgroundWorker, although there are other options. 回答2: There is implementation of BackgroundWorker for CF: http://www.danielmoth.com/Blog

Convert image to 1 bpp bitmap in .net compact framework

我与影子孤独终老i 提交于 2019-11-26 16:37:48
问题 I have an image of a signature I am trying to save as 1 bpp bitmap to save file space. The full .NET Framework has the enum PixelFormat.Format1bppIndexed , but the .NET Compact Framework does not supported it. Has any one discovered a way to accomplish this in Windows Mobile? 回答1: I had to do this in the past for generating black & white reports printed via Bluetooth (color or greyscale images were too large for the printer's buffer). Turned out I had to create the images using native code.

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

一世执手 提交于 2019-11-26 16:28:38
问题 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 =

Function that creates a timestamp in c#

梦想的初衷 提交于 2019-11-26 12:52:38
问题 I was wondering, is there a way to create a timestamp in c# from a datetime? I need a millisecond precision value that also works in Compact Framework(saying that since DateTime.ToBinary() does not exist in CF). My problem is that i want to store this value in a database agnostic way so i can sortby it later and find out which value is greater from another etc. 回答1: I always use something like the following: public static String GetTimestamp(this DateTime value) { return value.ToString(

Incorrectly aligned or overlapped by a non-object field error

旧巷老猫 提交于 2019-11-26 08:31:52
问题 I\'m trying to create the following structure: [StructLayout(LayoutKind.Explicit, Size=14)] public struct Message { [FieldOffset(0)] public ushort X; [FieldOffset(2)] [MarshalAs(UnmanagedType.ByValArray, SizeConst=5)] private ushort[] Y; [FieldOffset(12)] public ushort Z; } and I get the following error: Could not load type \'Message\' from assembly because it contains an object field at offset 4 that is incorrectly aligned or overlapped by a non-object field. Does anyone know why this is