コード例 #1
0
ファイル: XEventQueue.cs プロジェクト: sazae657/TonNurako
        /// <summary>
        /// コールバックの追加(Xt)
        /// </summary>
        /// <param name="mask"></param>
        /// <param name="proc"></param>
        public void AddCallback(ulong mask, G.XtEventHandler proc )
        {
            QueueData q = new QueueData();

            q.EventMask = mask;
            q.Proc = proc;

            // リストに追加
            callbacks.Add(q);

            //適用
            Apply();
        }
コード例 #2
0
ファイル: QueueDisplay.cs プロジェクト: harlam357/hfm-net
      public static void Write(QueueData q, IEnumerable<Argument> arguments)
      {
         Console.WriteLine("Queue version {0:0.00}", q.Version / 100);
         Console.WriteLine("Current index: {0}", q.CurrentIndex);

         bool currentOnly = arguments.FirstOrDefault(a => a.Type == ArgumentType.CurrentOnly) != null ? true : false;
         if (currentOnly)
         {
            var entry = q.GetQueueEntry(q.CurrentIndex);
            WriteEntry(entry, arguments);
         }
         else
         {
            uint i = IncrementIndex(q.CurrentIndex);
            while (true)
            {
               var entry = q.GetQueueEntry(i);
               WriteEntry(entry, arguments);

               if (i == q.CurrentIndex)
               {
                  break;
               }

               i = IncrementIndex(i);
            }
         }

         if (q.ResultsSentUtc.Equals(QueueData.Epoch2000) == false)
         {
            Console.WriteLine("Results successfully sent: {0:ddd MMM dd HH:mm:ss yyyy}", q.ResultsSentLocal);
         }
         Console.WriteLine("Average download rate {0:0.000} KB/s (u={1}); upload rate {2:0.000} KB/s (u={3})",
                           q.DownloadRateAverage, q.DownloadRateUnitWeight, q.UploadRateAverage, q.UploadRateUnitWeight);
         Console.WriteLine("Performance fraction {0:0.000000} (u={1})", q.PerformanceFraction, q.PerformanceFractionUnitWeight);
      }
コード例 #3
0
 public async Task Write(QueueData queue)
 {
     db.Queues.Add(queue);
     await db.SaveChangesAsync();
 }
コード例 #4
0
        /// <summary>
        /// This method implements the thread start for this service.
        /// </summary>
        protected override void Run()
        {
            // For logging, keep track of number of items found on queue, which of
            // those successfully uploaded, and which that were ignored/skipped.
            int queuedCount = 0, uploadedCount = 0, ignoredCount = 0;

            InetUploader inetUploader = null;

            try
            {
                PersistedQueue inetQueue = PersistedQueue.CreateInetInstance();

                while (true)
                {
                    if (!Runnable())   // Keep sending until the message queue is empty or we're stopped/paused.
                    {
                        break;
                    }

                    try
                    {
                        Log.Trace(">INET: Checking for non-empty queue.");

                        bool isEmpty = inetQueue.IsEmpty();

                        if (isEmpty)
                        {
                            Log.Trace(">INET: No data in upload queue.");
                            PendingUploads = false;
                            break;
                        }

                        Log.Debug(">INET: Retrieving queued item....");

                        // Get the oldest object on the queue (the object is not removed).
                        object queObject = inetQueue.Peek();

                        if (queObject == null)
                        {
                            Log.Debug(">INET: No data in upload queue.");
                            PendingUploads = false;
                            break;
                        }

                        PendingUploads = true;

                        string deviceLocation = string.Empty;

                        object wsParmObject = null;

                        queuedCount++;

                        QueueData queueData = null;
                        try
                        {
                            queueData = (QueueData)queObject;

                            double kB = (double)queueData.WebServiceParameterSize / 1024.0d; // convert bytes to kilobytes
                            Log.Debug(string.Format(">INET: {0} ({1},\"{2}\",{3}), {4} KB)...",
                                                    queueData, queueData.Id, Log.DateTimeToString(queueData.Timestamp), queueData.InetAccountNum, kB.ToString("f1")));

                            wsParmObject = queueData.WebServiceParameter;
                        }
                        catch (Exception e)
                        {
                            // If this failed, then something was on the queue which
                            // was not the right type.  Could have been old data.
                            // Just ignore it.
                            ignoredCount++;
                            Log.Debug(">INET: " + e.ToString());

                            // If debug build, DO NOT delete poison data. We need to keep
                            // it so that we can investigate what's wrong with it.
#if DEBUG
                            Log.Debug(">INET: Found non-conforming data on queue: ");
                            Log.Debug(">INET: " + queObject.ToString());
                            break;
#else
                            Log.Debug(">INET: Found non-conforming data on queue. Purging it:");
                            Log.Debug(">INET: " + queObject.ToString());
                            //_msmqTransaction.Commit();
                            inetQueue.Delete(queueData.Id);
                            continue;
#endif
                        }

                        // We don't instantiate iNet until we know we need it And, if we make it
                        // to here, then that's now.  We then will continue to re-use it for the duration
                        // that we remain in the loop.
                        if (inetUploader == null)
                        {
                            inetUploader = new InetUploader();
                        }

                        string errorCode = inetUploader.Upload(wsParmObject, queueData.Label, queueData.InetAccountNum);

                        // On any error, just break out and we'll retry on next iteration of Run().
                        // The intent is that if there's some network issue, or we're just offline,
                        // then we watn to let some time pass for the issue to clear up or to go back online.
                        if (errorCode != string.Empty)
                        {
                            break;
                        }

                        // Now that we've successfully uploaded it to iNet, we can remove it from the queue
                        Log.Debug(string.Format(">INET: Deleting uploaded {0} from queue.", queueData));
                        inetQueue.Delete(queueData.Id);

                        uploadedCount++;
                    }
                    // catch
                    catch (Exception ex1)
                    {
                        Log.Debug(">INET: Exception caught, - " + ex1.ToString());
                    }
                } // end-while !empty queue
            }
            finally
            {
                if (inetUploader != null)
                {
                    inetUploader.Dispose();
                }
            }

            if (queuedCount > 0)
            {
                Log.Debug(">INET: Finished. " + queuedCount + " found in queue, " + uploadedCount + " uploaded, " + ignoredCount + " ignored");
            }
        }
 public Task FinishMessageAsync(QueueData token)
 => WrapAsync(x => x.FinishMessageAsync(token));
コード例 #6
0
 public void UniLoad()
 {
     QueueData.QueueItemToLoad(gameObject, serializedGuid);
 }
コード例 #7
0
 internal Enumerator(QueueData <T> queue)
 {
     _queue   = queue;
     _index   = queue._index;
     _version = queue._version;
 }
コード例 #8
0
 public bool AddToQueue(ProductEntity product) =>
 QueueData.AddToQueue <ProductEntity>(product);
コード例 #9
0
        private void frmQueueStateModuleDesign_Load(object sender, EventArgs e)
        {
            try
            {
                InitQueueList();

                ceBackColor.Color = _queueStateDesign.BackColor;
                ceForeColor.Color = _queueStateDesign.ForeColor;
                ceBusyColor.Color = _queueStateDesign.BusyColor;
                ceWorkColor.Color = _queueStateDesign.WorkColor;
                ceFreeColor.Color = _queueStateDesign.FreeColor;

                txtFixRow.Text    = Convert.ToString(_queueStateDesign.FixRow);
                txtFixColumn.Text = Convert.ToString(_queueStateDesign.FixColumn);

                txtDefaultBusyCount.Text = Convert.ToString(_queueStateDesign.DefaultBusyCount);

                float     fontSize = 0;
                FontStyle fs       = FontStyle.Regular;

                try
                {
                    fontSize = _queueStateDesign.FontSize;
                }
                catch { }
                if (fontSize <= 0)
                {
                    fontSize = this.Font.Size;
                }

                if (_queueStateDesign.FontBold)
                {
                    fs = fs | FontStyle.Bold;
                }
                if (_queueStateDesign.FontItalic)
                {
                    fs = fs | FontStyle.Italic;
                }

                Font font = new Font(_queueStateDesign.FontName, fontSize, fs);
                feFontStyle.Value = font;

                chkUseRoomReleation.Checked = _queueStateDesign.UseRoomQueueReleation;

                listView1.Items.Clear();

                DataTable dtQueueData = _qm.GetQueueInfoByDeptId(_departmentId);

                foreach (DataRow drQueue in dtQueueData.Rows)
                {
                    QueueData queInfo = new QueueData();
                    queInfo.BindRowData(drQueue);

                    ListViewItem lvi = new ListViewItem(new string[] { queInfo.队列名称, "0" });

                    if (_queueStateDesign.QueueItems.Count > 0)
                    {
                        int index = _queueStateDesign.QueueItems.FindIndex(T => T.QueueId == queInfo.队列ID);

                        if (index >= 0)
                        {
                            QueueItem qi = _queueStateDesign.QueueItems[index];

                            lvi.SubItems[1].Text = Convert.ToString(qi.BusyCount);
                            lvi.Checked          = true;
                        }
                    }

                    lvi.Name = queInfo.队列名称;

                    lvi.Tag = queInfo;

                    listView1.Items.Add(lvi);
                }

                listView1.View = View.Details;
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
コード例 #10
0
        private void LoadDesign()
        {
            labCallContext.BackColor = Color.Transparent;
            labHead.BackColor        = Color.Transparent;

            this.BackColor = _queueCallDesign.TxtBColor;

            if (string.IsNullOrEmpty(_queueCallDesign.BackgroundImage) == false)
            {
                this.BackgroundImageLayout = ImageLayout.Stretch;
                this.BackgroundImage       = BigImgResource.LoadImg(_queueCallDesign.BackgroundImage);
            }

            if (_queueCallDesign.ShowHeader)
            {
                switch (_queueCallDesign.HeadDockWay)
                {
                case HeadDockWay.hdwTop:
                    labHead.Dock = DockStyle.Top;
                    break;

                case HeadDockWay.hdwLeft:
                    labHead.Dock = DockStyle.Left;
                    break;

                case HeadDockWay.hdwRight:
                    labHead.Dock = DockStyle.Right;
                    break;

                default:
                    labHead.Dock = DockStyle.Bottom;
                    break;
                }

                labHead.ForeColor = _queueCallDesign.HeadFColor;
                labHead.BackColor = _queueCallDesign.HeadBColor;

                float     fontSize = 0;
                FontStyle fs       = FontStyle.Regular;

                try
                {
                    fontSize = _queueCallDesign.HeadFontSize;
                }
                catch { }
                if (fontSize <= 0)
                {
                    fontSize = this.Font.Size;
                }


                if (_queueCallDesign.HeadFontBold)
                {
                    fs = fs | FontStyle.Bold;
                }
                if (_queueCallDesign.HeadFontItalic)
                {
                    fs = fs | FontStyle.Italic;
                }

                Font headFont = new Font(_queueCallDesign.HeadFontName, fontSize, fs);

                labHead.Font = headFont;

                if (string.IsNullOrEmpty(_queueCallDesign.HeadText))
                {
                    labHead.ImageAlign = ContentAlignment.MiddleCenter;
                    labHead.Text       = "";
                }
                else
                {
                    labHead.ImageAlign = ContentAlignment.TopCenter;

                    char[] txtChars = _queueCallDesign.HeadText.ToCharArray();

                    string headText = "";
                    foreach (char chr in txtChars)
                    {
                        if (headText != "")
                        {
                            headText = headText + '\r';
                        }

                        headText = headText + chr;
                    }
                    labHead.Text = headText;
                }

                labHead.Visible = true;



                labCallContext.ForeColor = _queueCallDesign.TxtFColor;
                labCallContext.Text      = "";


                float     txtfontSize = 0;
                FontStyle txtfs       = FontStyle.Regular;

                try
                {
                    txtfontSize = _queueCallDesign.TxtFontSize;
                }
                catch { }
                if (txtfontSize <= 0)
                {
                    txtfontSize = this.Font.Size;
                }


                if (_queueCallDesign.TxtFontBold)
                {
                    txtfs = txtfs | FontStyle.Bold;
                }
                if (_queueCallDesign.TxtFontItalic)
                {
                    txtfs = txtfs | FontStyle.Italic;
                }

                Font txtFont = new Font(_queueCallDesign.TxtFontName, txtfontSize, txtfs);

                labCallContext.Font = txtFont;


                _queueItems.Clear();
                if (_queueCallDesign.QueueItems.Count > 0)
                {
                    _queueItems = new List <QueueItem>(_queueCallDesign.QueueItems);
                }
                else
                {
                    //查询科室包含的队列
                    DataTable dtQueueData = QueueModel.GetQueueInfoByDeptId(_stationInfo.DepartmentId);

                    if (_queueCallDesign.UserRoomReleationQueue && string.IsNullOrEmpty(_stationInfo.RoomId) == false)
                    {
                        foreach (DataRow drQueue in dtQueueData.Rows)
                        {
                            QueueData queData = new QueueData();
                            queData.BindRowData(drQueue);

                            if (queData.包含房间.房间明细.FindIndex(T => T.房间ID == _stationInfo.RoomId) >= 0)
                            {
                                QueueItem qi = new QueueItem();

                                qi.QueueName = drQueue["队列名称"].ToString();
                                qi.QueueId   = drQueue["队列ID"].ToString();

                                _queueItems.Add(qi);
                            }
                        }
                    }
                    else
                    {
                        foreach (DataRow drQueue in dtQueueData.Rows)
                        {
                            QueueItem qi = new QueueItem();

                            qi.QueueName = drQueue["队列名称"].ToString();
                            qi.QueueId   = drQueue["队列ID"].ToString();

                            _queueItems.Add(qi);
                        }
                    }
                }
            }
            else
            {
                labHead.Visible = false;
            }
        }
コード例 #11
0
        public void ParseSPO2Packet(byte[] client)
        {
            try
            {
                byte[] rData2     = client;
                int[]  signalData = new int[25];
                bool[] checkSums  = new bool[25];
                bool   hasSpo2    = false;
                bool   hasRR      = false;
                for (int ii = 0; ii < 125; ii += 5)
                {
                    byte[] rData = new byte[5];
                    Array.Copy(rData2, ii, rData, 0, 5);
                    short sum = 0;
                    for (int i = 0; i < 4; i++)
                    {
                        sum += rData[i];
                    }
                    checkSums[ii / 5] = (sum == rData[4]);
                }



                for (int ii = 0; ii < 125; ii += 5)
                {
                    byte[] rData = new byte[5];
                    Array.Copy(rData2, ii, rData, 0, 5);
                    bool SNSD = isSet(rData[1], 6);
                    bool ARTF = isSet(rData[1], 5);
                    bool OOT  = isSet(rData[1], 4);
                    bool SNSA = isSet(rData[1], 3);
                    bool RPRF = isSet(rData[1], 2);
                    bool GPRF = isSet(rData[1], 1);
                    bool SYNC = isSet(rData[1], 0);
                    bool YPRF = RPRF & GPRF;
                    if (SYNC == true)
                    {
                        packetNumber = 0;
                    }

                    if (packetNumber >= 0)
                    {
                        short sum = 0;
                        for (int i = 0; i < 4; i++)
                        {
                            sum += rData[i];
                        }

                        snsd = SNSD;
                        snsa = SNSA;
                        QueueData data = new QueueData();
                        int       f    = ParseHexString((hexEncode(new byte[] { rData[2] })));
                        data.Data = f;
                        data.SNSA = SNSA;
                        data.SNSD = SNSD;
                        addData(data);


                        packetNumber++;

                        if (packetNumber == 21)
                        {
                            mHRMSB = hexEncode(new byte[] { rData[3] });
                            lastII = packetNumber;
                        }
                        if (packetNumber == 22)
                        {
                            mHRLSB = hexEncode(new byte[] { rData[3] });
                            if (lastII + 1 == packetNumber)
                            {
                                rr    = ParseHexString(mHRLSB + mHRMSB);
                                hasRR = true;
                            }
                        }
                        if (packetNumber == 16)
                        {
                            spo2    = ParseHexString((hexEncode(new byte[] { rData[3] })));
                            hasSpo2 = true;
                        }
                    }
                }

                if (hasSpo2 && hasRR)
                {
                    mSignalInfoEvent(rr, spo2, snsd, snsa);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #12
0
        private void LoadDesign()
        {
            labWaitCall.BackColor = Color.Transparent;
            labWaitCall.ForeColor = _queueQuickDesign.CallColor;

            labNext.BackColor = Color.Transparent;
            labNext.ForeColor = _queueQuickDesign.ForeColor;


            this.BackColor = _queueQuickDesign.BackColor;
            this.ForeColor = _queueQuickDesign.ForeColor;

            cbxQueueNames.ForeColor = _queueQuickDesign.ForeColor;
            labQueueCount.ForeColor = _queueQuickDesign.ForeColor;

            butMiss.ForeColor        = _queueQuickDesign.ForeColor;
            butOrderCall.ForeColor   = _queueQuickDesign.ForeColor;
            butRestartCall.ForeColor = _queueQuickDesign.ForeColor;
            butDiagnose.ForeColor    = _queueQuickDesign.ForeColor;



            float     fontSize = 0;
            FontStyle fs       = FontStyle.Regular;

            try
            {
                fontSize = _queueQuickDesign.ModuleFontSize;
            }
            catch { }
            if (fontSize <= 0)
            {
                fontSize = this.Font.Size;
            }


            if (_queueQuickDesign.ModuleFontBold)
            {
                fs = fs | FontStyle.Bold;
            }
            if (_queueQuickDesign.ModuleFontItalic)
            {
                fs = fs | FontStyle.Italic;
            }

            Font moduleFont = new Font(_queueQuickDesign.ModuleFontName, fontSize, fs);

            labNext.Font       = moduleFont;
            cbxQueueNames.Font = moduleFont;
            labQueueCount.Font = moduleFont;
            butMiss.Font       = moduleFont;

            butOrderCall.Font   = moduleFont;
            butRestartCall.Font = moduleFont;
            butDiagnose.Font    = moduleFont;


            _queueItems.Clear();

            //查询科室包含的队列
            DataTable dtQueueData = QueueModel.GetQueueInfoByDeptId(_stationInfo.DepartmentId);

            foreach (DataRow drQueue in dtQueueData.Rows)
            {
                QueueData queData = new QueueData();
                queData.BindRowData(drQueue);

                if (string.IsNullOrEmpty(_stationInfo.RoomId) == false)
                {
                    if (queData.包含房间.房间明细.FindIndex(T => T.房间ID == _stationInfo.RoomId) < 0)
                    {
                        continue;
                    }
                }

                QueueItem qi = new QueueItem();

                qi.QueueName = drQueue["队列名称"].ToString();
                qi.QueueId   = drQueue["队列ID"].ToString();

                _queueItems.Add(qi);
            }

            cbxQueueNames.Items.Clear();

            cbxQueueNames.DisplayMember = "Name";
            cbxQueueNames.ValueMember   = "Value";

            DataTable queueDatas = QueueModel.GetQueueInfoByDeptId(_stationInfo.DepartmentId);

            foreach (QueueItem qi in _queueItems)
            {
                DataRow[] drQueues = queueDatas.Select("队列ID='" + qi.QueueId + "'");

                if (drQueues.Length > 0)
                {
                    QueueData queData = new QueueData();
                    queData.BindRowData(drQueues[0]);

                    ItemBind ib = new ItemBind();

                    ib.Name  = queData.队列名称;
                    ib.Value = queData.队列ID;
                    ib.Tag   = queData;

                    cbxQueueNames.Items.Add(ib);
                }
            }

            if (cbxQueueNames.Items.Count > 0)
            {
                cbxQueueNames.SelectedIndex = 0;
            }
        }
コード例 #13
0
        private void WriteNestedObject(QueueData dataObject, Queue <QueueData> queue, ref int nextID)
        {
            object obj = dataObject.PayLoad;

            Type objectType = obj.GetType(), stringType = typeof(String);

            string           folderPath       = Path.GetDirectoryName(dataObject.FilePath);
            HashSet <string> nestedProperties = new HashSet <string>();

            IList <PropertyInfo> fields = this.GetFieldsOrdered(objectType);

            foreach (PropertyInfo propertyInfo in fields)
            {
                if (propertyInfo == null)
                {
                    continue;
                }
                Type propertyType = propertyInfo.PropertyType;
                XmlArrayAttribute     xmlArrayAttribute     = propertyInfo.GetCustomAttribute <XmlArrayAttribute>();
                XmlAttributeAttribute xmlAttributeAttribute = propertyInfo.GetCustomAttribute <XmlAttributeAttribute>();
                if (xmlArrayAttribute == null && xmlAttributeAttribute == null)
                {
                    if (propertyType.IsGenericType && typeof(IEnumerable).IsAssignableFrom(propertyType.GetGenericTypeDefinition()))
                    {
                        Type         genericType      = propertyType.GetGenericArguments()[0];
                        PropertyInfo uniqueIdProperty = genericType.GetProperty("id", typeof(string));
                        PropertyInfo nameProp         = objectType.GetProperty("Name", typeof(string));
                        if (uniqueIdProperty != null)
                        {
                            IEnumerable enumerable = propertyInfo.GetValue(obj) as IEnumerable;
                            if (enumerable != null)
                            {
                                bool allSaved = true, nestingValid = true;;
                                int  count = 0;
                                foreach (object nested in enumerable)
                                {
                                    if (nested == null)
                                    {
                                        continue;
                                    }
                                    count++;
                                    if (string.IsNullOrEmpty(_ObjectStore.EncounteredId(nested)))
                                    {
                                        allSaved = false;
                                    }
                                    object objId = uniqueIdProperty.GetValue(nested);
                                    if (objId == null || string.IsNullOrEmpty(objId.ToString()))
                                    {
                                        nestingValid = false;
                                        break;
                                    }
                                }
                                if (nestingValid && !allSaved)
                                {
                                    string nestedPath = Path.Combine(folderPath, removeInvalidFile(propertyInfo.Name));
                                    Directory.CreateDirectory(nestedPath);
                                    nestedProperties.Add(propertyInfo.Name);
                                    //if(count > 500)
                                    //{
                                    //	string prefix = m_NominatedTypeFilePrefix.Count > 0 ? hasFilePrefix(genericType) : "";
                                    //	IEnumerable<IGrouping<char, object>> groups = null;
                                    //	if (string.IsNullOrEmpty(prefix))
                                    //		groups = enumerable.Cast<object>().GroupBy(x => char.ToLower(uniqueIdProperty.GetValue(x).ToString()[0]));
                                    //	else
                                    //	{
                                    //		int prefixLength = prefix.Length;
                                    //		groups = enumerable.Cast<object>().GroupBy(x => char.ToLower(initialChar(uniqueIdProperty.GetValue(x).ToString(), prefix, prefixLength)));
                                    //	}
                                    //	if(groups.Count() > 2)
                                    //	{
                                    //		foreach(IGrouping<char,object> group in groups)
                                    //		{
                                    //			string alphaPath = Path.Combine(nestedPath, group.Key.ToString());
                                    //			Directory.CreateDirectory(alphaPath);
                                    //			foreach (object nested in group)
                                    //			{
                                    //				mObjectStore.MarkEncountered(nested, ref nextID);
                                    //				string nestedObjectPath = Path.Combine(alphaPath, removeInvalidFile(uniqueIdProperty.GetValue(nested).ToString()));
                                    //				Directory.CreateDirectory(nestedObjectPath);
                                    //				queue.Enqueue(new QueueData(Path.Combine(nestedObjectPath, removeInvalidFile(nested.GetType().Name) + ".xml"), nested));
                                    //			}
                                    //		}
                                    //		continue;
                                    //	}
                                    //}
                                    foreach (object nested in enumerable)
                                    {
                                        if (nested == null)
                                        {
                                            continue;
                                        }
                                        _ObjectStore.MarkEncountered(nested, ref nextID);
                                        string nestedObjectPath = Path.Combine(nestedPath, removeInvalidFile(uniqueIdProperty.GetValue(nested).ToString()));
                                        Directory.CreateDirectory(nestedObjectPath);
                                        queue.Enqueue(new QueueData(Path.Combine(nestedObjectPath, removeInvalidFile(propertyInfo.Name) + ".xml"), nested));
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        object propertyObject = propertyInfo.GetValue(obj);
                        if (propertyObject == null)
                        {
                            nestedProperties.Add(propertyInfo.Name);
                        }
                        else
                        {
                            DataType dataType = DataType.Custom;
                            string   fileExtension = ".txt", txt = "";
                            foreach (DataTypeAttribute dataTypeAttribute in propertyInfo.GetCustomAttributes <DataTypeAttribute>())
                            {
                                FileExtensionsAttribute fileExtensionsAttribute = dataTypeAttribute as FileExtensionsAttribute;
                                if (fileExtensionsAttribute != null && !string.IsNullOrEmpty(fileExtensionsAttribute.Extensions))
                                {
                                    fileExtension = fileExtensionsAttribute.Extensions;
                                }
                                if (dataTypeAttribute.DataType != DataType.Custom)
                                {
                                    dataType = dataTypeAttribute.DataType;
                                }
                            }
                            if (dataType == DataType.Html)
                            {
                                string html = propertyObject.ToString();
                                if (!string.IsNullOrEmpty(html))
                                {
                                    nestedProperties.Add(propertyInfo.Name);
                                    string htmlPath = Path.Combine(folderPath, propertyInfo.Name + ".html");
                                    File.WriteAllText(htmlPath, html);
                                    continue;
                                }
                            }
                            else if (dataType == DataType.MultilineText)
                            {
                                byte[] byteArray = propertyObject as byte[];
                                if (byteArray != null)
                                {
                                    nestedProperties.Add(propertyInfo.Name);
                                    txt = Encoding.ASCII.GetString(byteArray);
                                }
                                else
                                {
                                    txt = propertyObject.ToString();
                                }
                                if (!string.IsNullOrEmpty(txt))
                                {
                                    nestedProperties.Add(propertyInfo.Name);
                                    string txtPath = Path.Combine(folderPath, propertyInfo.Name + fileExtension);
                                    File.WriteAllText(txtPath, txt);
                                    continue;
                                }
                            }
                            Type propertyObjectType = propertyObject.GetType();
                            if (!(propertyObjectType.IsValueType || propertyObjectType == stringType))
                            {
                                if (string.IsNullOrEmpty(_ObjectStore.EncounteredId(obj)))
                                {
                                    DataContractAttribute dataContractAttribute = propertyObjectType.GetCustomAttribute <DataContractAttribute>(true);
                                    if (dataContractAttribute == null || dataContractAttribute.IsReference)
                                    {
                                        string nestedPath = Path.Combine(folderPath, removeInvalidFile(propertyInfo.Name));
                                        Directory.CreateDirectory(nestedPath);
                                        queue.Enqueue(new QueueData(Path.Combine(nestedPath, removeInvalidFile(propertyInfo.Name) + ".xml"), propertyObject));
                                        nestedProperties.Add(propertyInfo.Name);
                                        _ObjectStore.MarkEncountered(propertyObject, ref nextID);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (nestedProperties.Count < fields.Count)
            {
                _ObjectStore.RemoveEncountered(obj);
                using (FileStream fileStream = new FileStream(dataObject.FilePath, FileMode.Create, FileAccess.Write))
                {
                    writeObject(fileStream, obj, nestedProperties, ref nextID);
                }
            }
        }
コード例 #14
0
 public Task FinishMessageAsync(QueueData token)
 => WrapAsync(() => _impl.FinishMessageAsync(token), Name);
コード例 #15
0
 public static void TriggerObject(
     [QueueTrigger("fakequeue1")] QueueData triggerData,
     [MobileTable(Id = "{RecordId}")] TodoItem item)
 {
     Assert.NotNull(item);
 }
コード例 #16
0
        private void LoadDesign()
        {
            this.BackColor             = _queueStateDesign.BackColor;
            flowLayoutPanel1.BackColor = Color.Transparent;

            float     fontSize = 0;
            FontStyle fs       = FontStyle.Regular;

            try
            {
                fontSize = _queueStateDesign.FontSize;
            }
            catch { }
            if (fontSize <= 0)
            {
                fontSize = this.Font.Size;
            }

            if (_queueStateDesign.FontBold)
            {
                fs = fs | FontStyle.Bold;
            }
            if (_queueStateDesign.FontItalic)
            {
                fs = fs | FontStyle.Italic;
            }

            Font font = new Font(_queueStateDesign.FontName, fontSize, fs);

            this.Font = font;



            _queueItems.Clear();
            if (_queueStateDesign.QueueItems.Count > 0)
            {
                _queueItems = new List <QueueItem>(_queueStateDesign.QueueItems);
            }
            else
            {
                //查询科室包含的队列
                DataTable dtQueueData = QueueModel.GetQueueInfoByDeptId(_stationInfo.DepartmentId);

                if (_queueStateDesign.UseRoomQueueReleation && string.IsNullOrEmpty(_stationInfo.RoomId) == false)
                {
                    foreach (DataRow drQueue in dtQueueData.Rows)
                    {
                        QueueData queData = new QueueData();
                        queData.BindRowData(drQueue);

                        if (queData.包含房间.房间明细.FindIndex(T => T.房间ID == _stationInfo.RoomId) >= 0)
                        {
                            QueueItem qi = new QueueItem();

                            qi.QueueName = drQueue["队列名称"].ToString();
                            qi.QueueId   = drQueue["队列ID"].ToString();
                            qi.BusyCount = _queueStateDesign.DefaultBusyCount;

                            _queueItems.Add(qi);
                        }
                    }
                }
                else
                {
                    foreach (DataRow drQueue in dtQueueData.Rows)
                    {
                        QueueItem qi = new QueueItem();

                        qi.QueueName = drQueue["队列名称"].ToString();
                        qi.QueueId   = drQueue["队列ID"].ToString();
                        qi.BusyCount = _queueStateDesign.DefaultBusyCount;

                        _queueItems.Add(qi);
                    }
                }
            }
        }
コード例 #17
0
        private void butSure_Click(object sender, EventArgs e)
        {
            try
            {
                if (cbxQueueName.Items.Count <= 0)
                {
                    MessageBox.Show("尚无队列信息,不能入队。", "提示");
                    return;
                }

                if (txtQueueNo.Tag == null)
                {
                    MessageBox.Show("尚未产生排队号码,不能入队。", "提示");
                    return;
                }

                QueueData queueData = (cbxQueueName.SelectedItem as ItemBind).Tag as QueueData;


                DateTime serverDate = _qm.GetServerDate();

                string orderNum = serverDate.DayOfYear + "" + serverDate.TimeOfDay.Ticks;


                if (_qm.HasNo(Convert.ToInt32(txtQueueNo.Tag), queueData.队列ID, dtpIntoQueue.Value))
                {
                    MessageBox.Show("排队号码 [" + txtQueueNo.Text + "] 存在重复,需重新产生。", "提示");

                    int queueNo = GetQueueNo(cbxQueueName.Text, dtpIntoQueue.Value);
                    txtQueueNo.Text = queueData.队列信息.号码前缀 + queueNo;
                    txtQueueNo.Tag  = queueNo;

                    return;
                }

                _lineupInfo.队列ID = queueData.队列ID;
                _lineupInfo.队列名称 = queueData.队列名称;

                _lineupInfo.排队日期 = dtpIntoQueue.Value;
                _lineupInfo.排队号码 = Convert.ToString(txtQueueNo.Tag).PadLeft(queueData.队列信息.号码长度, '0');
                _lineupInfo.号码前缀 = queueData.队列信息.号码前缀;

                _lineupInfo.排队状态 = LineUpState.qsQueueing;

                _lineupInfo.附加信息.备注 = cbxMemo.Text;

                _lineupInfo.排队序号 = orderNum.ToString();


                _lineupInfo.附加信息.CopyBasePro(_lineupInfo);

                _qm.UpdateLineupInfo(_lineupInfo);

                _isOk = true;

                this.Close();
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
コード例 #18
0
 public ProductContract ProcessQueue() =>
 QueueData.DequeueItem <ProductContract>();
コード例 #19
0
        /// <summary>
        /// 初始化队列名称
        /// </summary>
        /// <param name="departmentId"></param>
        private void InitQueueName(string departmentId, string applyId)
        {
            cbxQueueName.Items.Clear();

            if (string.IsNullOrEmpty(departmentId))
            {
                return;
            }

            DataTable dtQueues = _qm.GetQueueInfoByDeptId(departmentId);

            cbxQueueName.DisplayMember = "Name";
            cbxQueueName.ValueMember   = "Value";

            DataTable dtRooms = _qm.GetApplyRoomId(applyId);


            foreach (DataRow dr in dtQueues.Rows)
            {
                QueueData queueData = new QueueData();
                queueData.BindRowData(dr);


                //如果队列不包含房间信息,则不进行加载
                if (queueData.包含房间.房间明细.Count <= 0)
                {
                    continue;
                }

                if (dtRooms.Rows.Count > 0)
                {
                    //需要判断队列是否包含了对应的房间
                    bool hasRoom = false;

                    foreach (DataRow drRoom in dtRooms.Rows)
                    {
                        if (queueData.包含房间.房间明细.FindIndex(T => T.房间ID == drRoom["房间ID"].ToString()) >= 0)
                        {
                            hasRoom = true;
                            break;
                        }
                    }

                    if (hasRoom == false)
                    {
                        continue;
                    }
                }


                ItemBind ib = new ItemBind();

                ib.Name  = queueData.队列名称;
                ib.Value = queueData.队列ID;

                ib.Tag = queueData;

                cbxQueueName.Items.Add(ib);
            }

            if (cbxQueueName.Items.Count <= 0)
            {
                return;
            }

            //默认定位到队列人数最少且只有一个房间的队列
            if (cbxQueueName.Items.Count <= 1)
            {
                cbxQueueName.SelectedIndex = 0;
            }
            else
            {
                int    roomCount = 999999;
                string minQueue  = "";
                foreach (ItemBind ib in cbxQueueName.Items)
                {
                    QueueData queData = ib.Tag as QueueData;

                    if (queData.包含房间.房间明细.Count == 1)
                    {
                        int curCount = _qm.GetLineupCount(queData.队列ID, dtpIntoQueue.Value);
                        if (curCount < roomCount)
                        {
                            roomCount = curCount;
                            minQueue  = queData.队列名称;
                        }
                    }
                }

                if (string.IsNullOrEmpty(minQueue) == false)
                {
                    cbxQueueName.Text = minQueue;
                }
            }
        }
コード例 #20
0
ファイル: TaskQueue.cs プロジェクト: MelloRin/D3DwithinCS
 public void setNext(QueueData next) => nextData = next;
コード例 #21
0
 public void AddToQueue(QueueData entry)
 {
     _buildingQueue.Queue.Add(entry);
     Timer.Start();
     NotifyStateChanged();
 }
コード例 #22
0
 public ConnectedUser(int id, IQueueMessageCallback registeredUser)
 {
     Id             = id;
     RegisteredUser = registeredUser;
     QueueData      = new QueueDataBuilder().Build();
 }
コード例 #23
0
 public void UniSave()
 {
     QueueData.QueueItemToSave(gameObject, serializedGuid);
 }