コード例 #1
0
        private void GetMeetingListCallback(IntPtr pData)
        {
            var getMeetingListResult =
                (GetMeetingListResult)Marshal.PtrToStructure(pData, typeof(GetMeetingListResult));

            List <MeetingRecord> meetingRecords = new List <MeetingRecord>();

            if (getMeetingListResult.m_result.m_rc == 0)
            {
                int meetingInfoByte = Marshal.SizeOf(typeof(MeetingInfo));

                MeetingInfo[] meetingInfos = new MeetingInfo[getMeetingListResult.m_meetingList.m_count];

                for (int i = 0; i < getMeetingListResult.m_meetingList.m_count; i++)
                {
                    IntPtr missPtr =
                        (IntPtr)(getMeetingListResult.m_meetingList.m_pMeetings.ToInt64() + i * meetingInfoByte);
                    meetingInfos[i] = (MeetingInfo)Marshal.PtrToStructure(missPtr, typeof(MeetingInfo));
                }

                meetingInfos.ToList().ForEach((meetingInfo =>
                {
                    DateTime baseDateTime = new DateTime(1970, 1, 1);
                    baseDateTime = baseDateTime.AddSeconds(double.Parse(meetingInfo.m_szStartTime));
                    string formattedStartTime = baseDateTime.ToString("yyyy-MM-dd HH:mm:ss");

                    meetingRecords.Add(new MeetingRecord()
                    {
                        MeetingType = meetingInfo.m_meetingType,
                        CreatorPhoneId = meetingInfo.m_szCreatorId,
                        CreatorName = meetingInfo.m_szCreatorName,
                        MeetingNo = meetingInfo.m_meetingId.ToString(),
                        StartTime = formattedStartTime,
                    });
                }));
            }

            SetResult("GetMeetingRecords", meetingRecords);
            //GetMeetingListEvent?.Invoke(meetingRecords);
        }
コード例 #2
0
        private void GetMeetingListEventHandler(GetMeetingListResult getMeetingListResult)
        {
            int meetingInfoByte = Marshal.SizeOf(typeof(MeetingInfo));

            MeetingInfo[] meetingInfos = new MeetingInfo[getMeetingListResult.m_meetingList.m_count];

            for (int i = 0; i < getMeetingListResult.m_meetingList.m_count; i++)
            {
                IntPtr missPtr = (IntPtr)(getMeetingListResult.m_meetingList.m_pMeetings.ToInt64() + i * meetingInfoByte);
                meetingInfos[i] = (MeetingInfo)Marshal.PtrToStructure(missPtr, typeof(MeetingInfo));
            }

            _meetingContentView.Dispatcher.BeginInvoke(new Action(() =>
            {
                if (meetingInfos.Count() > 0)
                {
                    MeetingRecords.Clear();
                }

                meetingInfos.ToList().ForEach((meetingInfo) =>
                {
                    DateTime baseDateTime     = new DateTime(1970, 1, 1);
                    baseDateTime              = baseDateTime.AddSeconds(double.Parse(meetingInfo.m_szStartTime));
                    string formattedStartTime = baseDateTime.ToString("yyyy-MM-dd HH:mm:ss");

                    MeetingRecords.Add(new MeetingRecord()
                    {
                        CreatorPhoneId           = meetingInfo.m_szCreatorId,
                        CreatorName              = meetingInfo.m_szCreatorName,
                        MeetingNo                = meetingInfo.m_meetingId.ToString(),
                        StartTime                = formattedStartTime,
                        JoinMeetingByListCommand = JoinMeetingFromListCommand
                    });
                });
            }));
        }