Example #1
0
        public static void Initialize()
        {
            if (Status != InitMode.NotReady)
            {
                throw new Exception("Pru1Aio may only be Initialized once.");
            }

            lock (Locker)
            {
                unsafe
                {
                    if (Pru1Aio.Aio == null)
                    {
                        Pru1Aio.Aio = new Pru1Aio();
                    }

                    IPruMem    = Pru1Aio.pru_rta_init();
                    ICallState = Pru1Aio.pru_rta_init_call_state();
                    PruMemory  = (PruSharedMemory *)IPruMem.ToPointer();
                    CallState  = (CallState *)ICallState.ToPointer();
                }

                _IsCapturing = false;
                _Status      = InitMode.Initialized;
            }
        }
Example #2
0
        /// <summary>
        /// 初始化已处理单据
        /// </summary>
        /// <param name="mode">初始化模式</param>
        private void InitFinishedBill(InitMode mode)
        {
            IQueryable <Flow_BillFlowMessage> result = m_billMsg.GetMessage(BasicInfo.LoginID);

            List <Flow_BillFlowMessage> dataSource =
                (from r in result
                 where r.单据状态 == BillStatus.已完成.ToString()
                 orderby r.单据类型, r.发起时间
                 select r).ToList();

            treeView.Nodes.Find("任务_已处理_单据", true)[0].Text = string.Format("单据({0})", dataSource.Count);

            if (mode == InitMode.刷新数据显示)
            {
                m_curNodeType = NodeType.已处理单据节点;

                dataGridView1.DataSource = new BindingCollection <Flow_BillFlowMessage>(dataSource);

                dataGridView1.Columns[0].Width = 60;
                dataGridView1.Columns[1].Width = 80;
                dataGridView1.Columns[3].Width = 80;
                dataGridView1.Columns[4].Width = 80;

                dataGridView1.Tag = dataSource;
            }
        }
        public void CreateFactory(InitMode mode)
        {
            var actualServices  = mode.HasFlag(InitMode.Services) ? Services.Object : null;
            var actualRegistrar = mode.HasFlag(InitMode.Registrar) ? Registrar.Object : null;

            Factory = new KeyedServiceFactory(actualRegistrar, actualServices);
        }
Example #4
0
        public DebugStyleCode(InitMode initMode)
#endif
        {
            switch (initMode)
            {
            case InitMode.UseLast:
            {
#if ACTIVE_CODE
                this = DebugDraw.ActiveSetup;
#else
                this = default;
#endif
                break;
            }

            default:
            {
                flag       = -1;
                debugSpace = DebugSpace.World;
                matrix     = Matrix4x4.identity;
                color      = Color.white;
                duration   = -1;
                depthTest  = false;
                precision  = 8;
                break;
            }
            }
        }
Example #5
0
        public static void Configure(int BufferSize, Channels ChannelEnabledMask, int SampleSoc, int SampleAverage, int SampleRate)
        {
            if (Status != InitMode.Initialized)
            {
                throw new Exception("Pru1Aio must be initialized prior to Configuration.");
            }

            lock (Locker)
            {
                unsafe
                {
                    AsynchCall = new AsynchronousCallBack(ProcessBuffer);

                    PruMemory->Control.BufferCount        = 0;
                    PruMemory->Control.BufferSize         = (byte)BufferSize;         // 40;
                    PruMemory->Control.ChannelEnabledMask = (byte)ChannelEnabledMask; // 0x7F;
                    PruMemory->Control.SampleSoc          = (byte)SampleSoc;          // 15;
                    PruMemory->Control.SampleAverage      = (byte)SampleAverage;      // 16;
                    PruMemory->Control.SampleRate         = (uint)SampleRate;         // 1000;

                    IBuffer       = Pru1Aio.pru_rta_init_capture_buffer(PruMemory);
                    CaptureBuffer = (Pru1AioReading *)IBuffer.ToPointer();
                }

                _IsCapturing       = false;
                _Status            = InitMode.Configured;
                _TotalRecords      = 0;
                CurrentBufferIndex = 0;
            }
        }
Example #6
0
        /// <summary>
        /// 处理日常事务
        /// </summary>
        /// <param name="mode">初始化模式</param>
        private void InitDailyAffair(InitMode mode)
        {
            if (mode == InitMode.刷新数据显示)
            {
                m_curNodeType = NodeType.通知类节点;
            }

            InitNodiceMessage(mode, NoticeSource.日常事务);
        }
Example #7
0
        /// <summary>
        /// 处理单据处理后知会
        /// </summary>
        /// <param name="mode">初始化模式</param>
        private void InitBillNoticeMessage(InitMode mode)
        {
            if (mode == InitMode.刷新数据显示)
            {
                m_curNodeType = NodeType.单据处理后知会;
            }

            InitNodiceMessage(mode, NoticeSource.单据处理后知会);
        }
        public TestUniverse(InitMode mode = InitMode.All)
        {
            Services  = new Mock <IServiceProvider>(MockBehavior.Strict);
            Registrar = new Mock <IKeyedServiceRegister>(MockBehavior.Strict);

            if (mode.HasFlag(InitMode.CreateFactory))
            {
                CreateFactory(mode);
            }
        }
Example #9
0
 public static void Stop()
 {
     _IsCapturing = false;
     _Status      = InitMode.Initialized;
     unsafe
     {
         Pru1Aio.pru_rta_stop_capture(PruMemory);
         MessageInvoker(MessageType.Stop, new Reading(), 0, 0);
     }
 }
Example #10
0
 // first time init
 public RegionExposedFiles(InitMode mode, String location)
     : this(location)
 {
     if (mode != InitMode.NEW_REGION) {
         throw new Exception("first time init needs NEW_REGION paramater");
     }
     if (!Directory.Exists(dir_path)) {
         Console.WriteLine("RegionExposedFiles, creating directory: " + dir_path);
         Directory.CreateDirectory(dir_path);
     }
 }
Example #11
0
        /// <summary>
        /// 处理预警消息
        /// </summary>
        /// <param name="mode">初始化模式</param>
        private void InitMeetingNotice(InitMode mode)
        {
            List <Flow_WarningNotice> dataSource = (from r in PlatformFactory.GetObject <IWarningNotice>().GetWarningNotice(BasicInfo.LoginID)
                                                    where r.附加信息1 == "会议管理" && ServerTime.Time < Convert.ToDateTime(r.附加信息3)
                                                    orderby r.附加信息3, r.附加信息4
                                                    select r).ToList();

            treeView.Nodes.Find("通知_会议提醒", true)[0].Text = string.Format("会议提醒({0})", dataSource.Count);

            if (mode == InitMode.刷新数据显示)
            {
                m_curNodeType = NodeType.会议提醒节点;

                dataGridView1.DataSource = new BindingCollection <Flow_WarningNotice>(dataSource);

                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();

                dataGridView1.Columns[0].Width = 40;
                dataGridView1.Columns[1].Width = 80;
                dataGridView1.Columns[3].Width = 80;
                dataGridView1.Columns[4].Width = 80;

                column.Visible    = true;
                column.Name       = "接收方姓名";
                column.HeaderText = "接收方姓名";
                column.ValueType  = typeof(string);
                column.ReadOnly   = true;
                dataGridView1.Columns.Insert(4, column);

                dataGridView1.Tag = dataSource;

                dataGridView1.Columns["接收方"].Visible   = false;
                dataGridView1.Columns["接收方类型"].Visible = false;

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    DataGridViewCellCollection cells = dataGridView1.Rows[i].Cells;

                    if (dataGridView1.Columns.Contains("接收方类型") &&
                        dataGridView1.Columns.Contains("接收方姓名") &&
                        dataGridView1.Columns.Contains("接收方") &&
                        dataGridView1.Columns.Contains("状态"))
                    {
                        if (cells["接收方类型"].Value.ToString() == BillFlowMessage_ReceivedUserType.用户.ToString())
                        {
                            cells["接收方姓名"].Value =
                                m_user.GetUser(cells["接收方"].Value.ToString()).姓名;
                        }

                        cells["状态"].Value = cells["状态"].Value.ToString();
                    }
                }
            }
        }
Example #12
0
        private static void OpenPlugin(InitMode initMode)
        {
#if UNITY_EDITOR
            string loadPath;
#if UNITY_EDITOR_WIN
            // Copy native library to temporary file
            try
            {
                File.Copy(pluginPath, pluginTempPath, true);
            }
            catch (Exception)
            {
                var handleValue = PlayerPrefs.GetInt("LibraryPointer", 0);

                if (handleValue != 0)
                {
                    var handle = new IntPtr(handleValue);
                    CloseLibrary(handle);
                    File.Copy(pluginPath, pluginTempPath, true);
                }
            }

            loadPath = pluginTempPath;
#else
            loadPath = pluginPath;
#endif
            // Open native library
            libraryHandle = OpenLibrary(loadPath);
            InitDelegate Init = GetDelegate <InitDelegate>(
                libraryHandle,
                "Init");
#endif

            // Init C++ library
            Init(
                memory,
                memorySize,
                initMode,
                Marshal.GetFunctionPointerForDelegate(new SetExceptionDelegate(SetException))
                );

            if (UnhandledCppException != null)
            {
                Exception ex = UnhandledCppException;
                UnhandledCppException = null;
                throw new Exception("Unhandled C++ exception in Init", ex);
            }

            s_isInit = true;
        }
Example #13
0
        /// <summary>
        /// 初始化任务消息
        /// </summary>
        /// <param name="mode">初始化模式</param>
        private void InitTaskMsg(InitMode mode)
        {
            List <View_Flow_TaskNotice> dataSource = m_taskNotice.GetTaskNotice(BasicInfo.LoginID).ToList();

            treeView.Nodes.Find("任务_待处理_任务管理", true)[0].Text = string.Format("任务管理({0})", dataSource.Count());

            if (mode == InitMode.刷新数据显示)
            {
                m_curNodeType = NodeType.任务管理节点;

                dataGridView1.DataSource = new BindingCollection <View_Flow_TaskNotice>(dataSource);

                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();

                column.Visible    = true;
                column.Name       = "天数";
                column.HeaderText = "天数";
                column.ValueType  = typeof(int);
                column.ReadOnly   = true;
                column.Width      = 40;

                dataGridView1.Columns.Insert(0, column);

                dataGridView1.Tag = dataSource;

                dataGridView1.Columns["序号"].Visible = false;

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    dataGridView1.Rows[i].Cells["天数"].Value = (ServerModule.ServerTime.Time -
                                                               (DateTime)dataGridView1.Rows[i].Cells["发送时间"].Value).Days;

                    if ((int)dataGridView1.Rows[i].Cells["天数"].Value > 3)
                    {
                        dataGridView1.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
                    }
                    else if ((int)dataGridView1.Rows[i].Cells["天数"].Value > 1)
                    {
                        dataGridView1.Rows[i].DefaultCellStyle.ForeColor = Color.FromArgb(255, 128, 128);
                    }
                }

                dataGridView1.Tag = dataSource;
            }

            if (dataSource.Count > 0)
            {
                contextMenuStrip1.Enabled = true;
            }
        }
Example #14
0
        public AVCaptureVideoPreviewLayer(AVCaptureSession session, InitMode mode) : base(NSObjectFlag.Empty)
        {
            switch (mode)
            {
            case InitMode.WithConnection:
                InitializeHandle(InitWithConnection(session));
                break;

            case InitMode.WithNoConnection:
                InitializeHandle(InitWithNoConnection(session));
                break;

            default:
                throw new ArgumentException(nameof(mode));
            }
        }
        public void Generate(int fs, double scale, InitMode iNorthWest, InitMode iNorth, InitMode iWest, InitMode iCenter)
        {
            if (values != null)
            {
                values = null;
            }
            values = new double[width * height];

            if (iNorthWest == InitMode.INIT_RANDOM && iNorth == InitMode.INIT_RANDOM && iWest == InitMode.INIT_RANDOM && iCenter == InitMode.INIT_RANDOM)
            {
                // Thoroughly initialize random grid.
                for (int y = 0; y < height; y += 8)
                {
                    for (int x = 0; x < width; x += 8)
                    {
                        setPoint(x, y, frand());
                    }
                }
            }
            else
            {
                // Initialize with user config.
                double n;
                n = iNorthWest == InitMode.INIT_RANDOM ? frand() : (float)iNorthWest - 2.0;
                setPoint(0, 0, n);
                n = iNorth == InitMode.INIT_RANDOM ? frand() : (float)iNorth - 2.0;
                setPoint(width / 2, 0, n);
                n = iWest == InitMode.INIT_RANDOM ? frand() : (float)iWest - 2.0;
                setPoint(0, height / 2, n);
                n = iCenter == InitMode.INIT_RANDOM ? frand() : (float)iCenter - 2.0;
                setPoint(width / 2, height / 2, n);
            }

            int samples = fs;

            while (samples > 0)
            {
                divide(samples, scale);
                samples /= 2;
                scale   /= 2.0;
            }

            //			for (int i=0; i<10; i++) {
            //				Debug.Log ("values: " + values[5000+i]);
            //			}
        }
Example #16
0
        public void Generate(int fs, double scale, InitMode iNorthWest, InitMode iNorth, InitMode iWest, InitMode iCenter)
        {
            if (values != null)
            {
                values = null;
            }
            values = new double[width * height];

            if (iNorthWest == InitMode.INIT_RANDOM && iNorth == InitMode.INIT_RANDOM && iWest == InitMode.INIT_RANDOM && iCenter == InitMode.INIT_RANDOM)
            {
                // Thoroughly initialize random grid.
                for (int y = 0; y < height; y += 8)
                {
                    for (int x = 0; x < width; x += 8)
                    {
                        setPoint(x, y, frand());
                    }
                }
            }
            else
            {
                // Initialize with user config.
                double n;
                n = iNorthWest == InitMode.INIT_RANDOM ? frand() : (float)iNorthWest - 2.0;
                setPoint(0, 0, n);
                n = iNorth == InitMode.INIT_RANDOM ? frand() : (float)iNorth - 2.0;
                setPoint(width / 2, 0, n);
                n = iWest == InitMode.INIT_RANDOM ? frand() : (float)iWest - 2.0;
                setPoint(0, height / 2, n);
                n = iCenter == InitMode.INIT_RANDOM ? frand() : (float)iCenter - 2.0;
                setPoint(width / 2, height / 2, n);
            }

            int samples = fs;
            while (samples > 0)
            {
                divide(samples, scale);
                samples /= 2;
                scale /= 2.0;
            }

            //			for (int i=0; i<10; i++) {
            //				Debug.Log ("values: " + values[5000+i]);
            //			}
        }
        static Serializable get(Type serializable_type, string file, InitMode init_mode)
        {
            if (!Path.IsPathRooted(file))
            {
                file = Log.AppCompanyCommonDataDir + System.IO.Path.DirectorySeparatorChar + file;
            }
            Serializable s;

            if (init_mode == InitMode.CREATE || (init_mode == InitMode.LOAD_OR_CREATE && !File.Exists(file)))
            {
                s = (Serializable)Activator.CreateInstance(serializable_type);
            }
            else
            {
                s = (Serializable)Cliver.Serialization.Json.Load(serializable_type, file);
            }
            s.__File = file;
            return(s);
        }
Example #18
0
        /// Initialize every actor or monocache on childs of the selected gameobject
        public void InitChilds(GameObject obj, InitMode mode = InitMode.All)
        {
            var transforms = obj.GetComponentsInChildren <Transform>(mode == InitMode.All);

            for (var i = 1; i < transforms.Length; i++)
            {
                var tr = transforms[i];
                tr.gameObject.SetActive(true);
                var oo = tr.GetComponents <MonoBehaviour>();

                foreach (var o in oo)
                {
                    if (o is IRequireActorsLayer req)
                    {
                        req.Bootstrap(layer);
                        o.enabled = true;
                    }
                }
            }
        }
Example #19
0
 public static extern void Unity_InitAsync(InitMode initmode);
Example #20
0
        /// <summary>
        /// 初始化未处理单据
        /// </summary>
        /// <param name="mode">初始化模式</param>
        private void InitUnsettledBill(InitMode mode)
        {
            IQueryable <Flow_BillFlowMessage> result = m_billMsg.GetReceivedMessage(BasicInfo.LoginID);

            result = from a in result
                     where a.单据状态 != BillStatus.已完成.ToString() && !a.单据状态.Contains("废")
                     select a;

            List <string> lstBillNo = result.Select(k => k.单据号).Distinct().ToList();

            m_lstMessage = (from a in m_lstMessage
                            where lstBillNo.Contains(a.单据号)
                            select a).ToList();

            lstBillNo = m_lstMessage.Select(k => k.单据号).Distinct().ToList();

            List <Flow_BillFlowMessage> dataSource = (from r in result
                                                      where !lstBillNo.Contains(r.单据号)
                                                      orderby r.单据类型 ascending, r.发起时间 ascending
                                                      select r).ToList();

            List <Flow_BillFlowMessage> bindSource = new List <Flow_BillFlowMessage>();

            bindSource.AddRange(m_lstMessage);
            bindSource.AddRange(dataSource);

            treeView.BeginInvoke(new Action(delegate
            {
                treeView.Nodes.Find("任务_待处理_单据", true)[0].Text = string.Format("单据({0})", bindSource.Count);
            }));

            if (mode == InitMode.刷新数据显示)
            {
                m_curNodeType = NodeType.待处理单据节点;

                dataGridView1.Invoke(new Action(delegate
                {
                    dataGridView1.Columns.Clear();
                    dataGridView1.DataSource         = new BindingCollection <Flow_BillFlowMessage>(bindSource);
                    DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();

                    column.Visible    = true;
                    column.Name       = "天数";
                    column.HeaderText = "天数";
                    column.ValueType  = typeof(int);
                    column.ReadOnly   = true;
                    column.Width      = 40;

                    dataGridView1.Columns["序号"].Width    = 60;
                    dataGridView1.Columns["单据类型"].Width  = 120;
                    dataGridView1.Columns["单据号"].Width   = 110;
                    dataGridView1.Columns["发起方消息"].Width = 450;

                    dataGridView1.Columns.Insert(0, column);

                    dataGridView1.Tag = bindSource;

                    dataGridView1.Columns["单据流水号"].Visible     = false;
                    dataGridView1.Columns["发起方用户信息"].Visible   = false;
                    dataGridView1.Columns["初始发起方用户编码"].Visible = false;
                    dataGridView1.Columns["发起方用户编码"].Visible   = false;
                    dataGridView1.Columns["期望的处理完成时间"].Visible = false;
                    dataGridView1.Columns["接收方类型"].Visible     = false;
                    dataGridView1.Columns["单据状态"].Visible      = false;
                    dataGridView1.Columns["附加信息1"].Visible     = false;
                    dataGridView1.Columns["附加信息2"].Visible     = false;
                    dataGridView1.Columns["附加信息3"].Visible     = false;
                    dataGridView1.Columns["附加信息4"].Visible     = false;
                    dataGridView1.Columns["附加信息5"].Visible     = false;
                    dataGridView1.Columns["附加信息6"].Visible     = false;
                    dataGridView1.Columns["附加信息7"].Visible     = false;
                    dataGridView1.Columns["附加信息8"].Visible     = false;
                }));

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    dataGridView1.Rows[i].Cells["天数"].Value = (ServerModule.ServerTime.Time -
                                                               (DateTime)dataGridView1.Rows[i].Cells["发起时间"].Value).Days;

                    if (m_lstMessage.Where(k => k.单据号 == dataGridView1.Rows[i].Cells["单据号"].Value.ToString()).Count() > 0)
                    {
                        dataGridView1.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
                    }
                }
            }
        }
Example #21
0
 public ModuleInfo(string moduleName, Type moduleType, InitMode initMode) : this(moduleName, moduleType.AssemblyQualifiedName)
 {
 }
Example #22
0
 public static IModuleCatalog AddModule <T>(this IModuleCatalog moduleCatalog, string name, InitMode mode)
     where T : IModule => moduleCatalog.AddModule(new ModuleInfo(typeof(T), name, mode));
Example #23
0
 public static IModuleCatalog AddModule <T>(this IModuleCatalog moduleCatalog, InitMode mode = InitMode.WhenAvailable)
     where T : IModule => moduleCatalog.AddModule <T>(typeof(T).Name, mode);
Example #24
0
        /// <summary>
        /// 处理通知类消息
        /// </summary>
        /// <param name="mode">初始化模式</param>
        /// <param name="source">消息源</param>
        private void InitNodiceMessage(InitMode mode, NoticeSource source)
        {
            List <Flow_Notice> dataSource =
                (from r in m_flowNotice.GetNotice(BasicInfo.LoginID, source)
                 orderby r.标题, r.发送时间, r.发送人
                 select r).ToList();

            if (source == NoticeSource.日常事务)
            {
                treeView.Nodes.Find("通知_日常事务", true)[0].Text = string.Format("日常事务({0})", dataSource.Count);
            }
            else if (source == NoticeSource.单据处理后知会)
            {
                treeView.Nodes.Find("通知_单据处理后知会", true)[0].Text = string.Format("单据处理后知会({0})", dataSource.Count);
            }

            if (mode == InitMode.刷新数据显示)
            {
                dataGridView1.DataSource = new BindingCollection <Flow_Notice>(dataSource);

                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();

                column.Visible    = true;
                column.Name       = "天数";
                column.HeaderText = "天数";
                column.ValueType  = typeof(int);
                column.ReadOnly   = true;
                column.Width      = 40;

                dataGridView1.Columns[1].Width = 60;
                dataGridView1.Columns[2].Width = 80;
                dataGridView1.Columns[4].Width = 80;
                dataGridView1.Columns[5].Width = 80;

                dataGridView1.Columns.Insert(0, column);

                column = new DataGridViewTextBoxColumn();

                column.Visible    = true;
                column.Name       = "接收人姓名";
                column.HeaderText = "接收人姓名";
                column.ValueType  = typeof(string);
                column.ReadOnly   = true;
                dataGridView1.Columns.Insert(5, column);

                dataGridView1.Tag = dataSource;

                dataGridView1.Columns["发送人"].Visible = false;
                dataGridView1.Columns["接收人"].Visible = false;

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Columns.Contains("接收方类型") &&
                        dataGridView1.Columns.Contains("接收方姓名") &&
                        dataGridView1.Columns.Contains("接收方") &&
                        dataGridView1.Columns.Contains("状态"))
                    {
                        dataGridView1.Rows[i].Cells["接收人姓名"].Value =
                            m_user.GetUser(dataGridView1.Rows[i].Cells["接收人"].Value.ToString()).姓名;

                        dataGridView1.Rows[i].Cells["状态"].Value = dataGridView1.Rows[i].Cells["状态"].Value.ToString();
                        dataGridView1.Rows[i].Cells["天数"].Value = (ServerModule.ServerTime.Time -
                                                                   (DateTime)dataGridView1.Rows[i].Cells["发送时间"].Value).Days;
                    }
                }
            }
        }
Example #25
0
        /// <summary>
        /// 初始化界面
        /// </summary>
        /// <param name="mode">初始化模式</param>
        /// <param name="node">树节点</param>
        private void InitForm(InitMode mode, TreeNode node)
        {
            if (m_flowNotice == null)
            {
                m_flowNotice = PlatformFactory.GetObject <IFlowNoticeManagement>();
                m_billMsg    = PlatformFactory.GetObject <IBillFlowMessage>();
            }

            if (mode == InitMode.刷新数据显示)
            {
                lblTitle.Text             = "";
                txtContent.Text           = "";
                contextMenuStrip1.Enabled = false;
            }

            switch (node.Name)
            {
            case "通知_预警消息":
                InitWarningNotice(mode);
                break;

            case "通知_会议提醒":
                InitMeetingNotice(mode);
                break;

            case "通知_日常事务":
                InitDailyAffair(mode);
                break;

            case "通知_单据处理后知会":
                InitBillNoticeMessage(mode);

                if (mode == InitMode.刷新数据显示)
                {
                    contextMenuStrip1.Enabled = true;
                }
                break;

            case "任务_待处理_单据":
                ThreadPool.QueueUserWorkItem((WaitCallback) delegate
                {
                    lock (locker)
                    {
                        InitUnsettledBill(mode);
                    }
                });

                if (mode == InitMode.刷新数据显示)
                {
                    contextMenuStrip1.Enabled = true;
                }
                break;

            case "任务_已处理_单据":
                InitFinishedBill(mode);

                if (mode == InitMode.刷新数据显示)
                {
                    contextMenuStrip1.Enabled = true;
                }

                break;

            case "任务_待处理_任务管理":
                InitTaskMsg(mode);
                break;

            default:
                if (mode == InitMode.刷新数据显示)
                {
                    ClearForm();
                }
                break;
            }

            if (mode == InitMode.刷新数据显示)
            {
                dataGridView1.Refresh();

                if (dataGridView1.Columns.Contains("序号"))
                {
                    dataGridView1.Columns["序号"].Visible = false;
                }

                treeView.Focus();
            }

            userControlDataLocalizer1.Init(dataGridView1, this.Name,
                                           UniversalFunction.SelectHideFields(this.Name, dataGridView1.Name, BasicInfo.LoginID));
        }
Example #26
0
        public static void Start(int RunTimeMs = 2000, int Readings = 0, BufferMode Mode = BufferMode.Fill)
        {
            if (Status != InitMode.Configured)
            {
                throw new Exception("Pru1Aio must be configured prior to operation.");
            }

            lock (Pru1Aio.Locker)
            {
                Pru1Aio.Mode      = Mode;
                Pru1Aio.RunTimeMs = RunTimeMs;
                RunLimit          = false;

                unsafe
                {
                    if (Readings % PruMemory->Control.BufferSize != 0)
                    {
                        throw new Exception("Readings must be a multiple of the buffer size.  Inter-buffer reading limits are not supported.");
                    }

                    if (Pru1Aio.Mode == BufferMode.Fill || RunTimeMs > 0)
                    {
                        RunLimit = true;
                        if (RunTimeMs == 0 && Readings == 0)
                        {
                            Pru1Aio.pru_rta_stop_capture(PruMemory);
                            Pru1Aio.pru_rta_clear_pru((int)PRU_NUM.PRU1);
                            Pru1Aio.pru_rta_clear_pru((int)PRU_NUM.PRU0);
                            return;
                        }
                        if (RunTimeMs > 0 && Readings == 0)
                        {
                            //Pru1Aio._Buffer = new Pru1AioReading[RunTimeMs / 1000 * PruMemory->Control.SampleRate];
                            Pru1Aio._Buffer = Pru1Aio.InitializeArray <Reading>((int)(RunTimeMs / 1000 * PruMemory->Control.SampleRate));
                            _Calls          = (int)(PruMemory->Control.SampleRate / PruMemory->Control.BufferSize * RunTimeMs / 1000);
                        }
                        else if (RunTimeMs == 0 && Readings > 0)
                        {
                            //Pru1Aio._Buffer = new Pru1AioReading[Readings];
                            Pru1Aio._Buffer = Pru1Aio.InitializeArray <Reading>((int)(Readings));
                            _Calls          = Readings / PruMemory->Control.BufferSize;
                        }
                        else if (RunTimeMs > 0 && Readings > 0)
                        {
                            //Pru1Aio._Buffer = new Pru1AioReading[Readings];
                            Pru1Aio._Buffer = Pru1Aio.InitializeArray <Reading>((int)(Readings));
                            _Calls          = (int)(PruMemory->Control.SampleRate / PruMemory->Control.BufferSize * RunTimeMs / 1000);
                        }
                    }
                    else if (Pru1Aio.Mode == BufferMode.Ring)
                    {
                        //Pru1Aio._Buffer = new Pru1AioReading[Readings];
                        Pru1Aio._Buffer  = Pru1Aio.InitializeArray <Reading>((int)(Readings));
                        Pru1Aio.RunLimit = false;
                    }

                    _DroppedBuffers = new List <int>();

                    Pru1Aio.pru_rta_configure(&(PruMemory->Control));

                    Pru1Aio.pru_rta_start_firmware();

                    Signals      = 0;
                    _IsCapturing = true;
                    _Status      = InitMode.Running;
                    MessageInvoker(MessageType.Start, new Reading(), 0, 0);
                    Pru1Aio.pru_rta_start_capture(PruMemory, CaptureBuffer, CallState, AsynchCall);
                }
            }
        }
Example #27
0
 private Pru1Aio()
 {
     // forces libprussdrv to load
     Pru1Aio.prussdrv_strversion(1);
     _Status = InitMode.NotReady;
 }
Example #28
0
        ///-----------------------------------------------------------------
#if ACTIVE_CODE
        public DebugStyle(InitMode initMode)
Example #29
0
        private static unsafe void ProcessBuffer(uint BufferCount, ushort BufferSize, Pru1AioReading *CapturedBuffer, CallState *CallState, PruSharedMemory *PruMemory)
        {
            Signals++;

            LastBufferCount = (int)PruMemory->Control.BufferCount;

            Reading mread = new Reading();

            for (int i = 0; i < 8; i++)
            {
                mread.Readings[i] = CallState->BufferMean.Readings[i];
            }
            mread.Buffer    = CallState->BufferMean.Buffer;
            mread.DigitalIn = CallState->BufferMean.DigitalIn;
            _MeanReading    = mread;

            int LastGoodBuffer = Signals;

            if (Signals < LastBufferCount)
            {
                do
                {
                    DropBuffer(Signals, mread, LastGoodBuffer, (int)BufferSize);
                    Signals++;
                } while (Signals < LastBufferCount);
            }

            Pru1Aio.pru_rta_set_digital_out(PruMemory, 0xF, _DigitalOutput);

            if (IsCapturing && Status == InitMode.Running)
            {
                for (int record = 0; record < BufferSize; record++)
                {
                    if (CurrentBufferIndex >= _Buffer.Length)
                    {
                        if (Mode == BufferMode.Ring)
                        {
                            CurrentBufferIndex = 0;
                            MessageInvoker(MessageType.Ring, mread, CurrentBufferIndex, (int)BufferSize);
                        }
                        else
                        {
                            MessageInvoker(MessageType.Overflow, mread, CurrentBufferIndex, (int)BufferSize);
                            _IsCapturing = false;
                            break;
                        }
                    }
                    for (int channel = 0; channel < PruMemory->Control.ChannelCount; channel++)
                    {
                        /*
                         * fixed (Pru1AioReading* readings = _Buffer)
                         * {
                         *  readings[CurrentBufferIndex].Readings[channel] = CapturedBuffer[record].Readings[channel];
                         * }
                         */
                        _Buffer[CurrentBufferIndex].Readings[channel] = CapturedBuffer[record].Readings[channel];
                    }
                    _Buffer[CurrentBufferIndex].DigitalIn = CapturedBuffer[record].DigitalIn;
                    _Buffer[CurrentBufferIndex].Buffer    = CapturedBuffer[record].Buffer;
                    CurrentBufferIndex++;
                    _TotalRecords++;
                }
            }

            MessageInvoker(MessageType.Notification, mread, CurrentBufferIndex, (int)BufferSize);

            if (RunLimit)
            {
                _Calls--;
                if (_Calls == 0)
                {
                    Pru1Aio.pru_rta_stop_capture(PruMemory);
                    _Status = InitMode.Initialized;
                    MessageInvoker(MessageType.Stop, new Reading(), 0, 0);
                }

                if (CurrentBufferIndex >= _Buffer.Length && Pru1Aio.Mode == BufferMode.Fill)
                {
                    Pru1Aio.pru_rta_stop_capture(PruMemory);
                    _Status = InitMode.Initialized;
                    MessageInvoker(MessageType.Stop, new Reading(), 0, 0);
                }
            }

            return;
        }
Example #30
0
 public ModuleInfo(Type moduleType, string moduleName, InitMode initializationMode)
     : this(moduleName, moduleType.AssemblyQualifiedName)
 {
     InitializeMode = initializationMode;
 }
Example #31
0
        /// <summary>
        ///	属性を初期化する。
        /// </summary>
        private void InitAtr(InitMode mode, IntPtr pIDL, ShellAPI.IShellFolder parentSf)
        {
            //	基本的な属性を初期化する
            ShellAPI.SFGAOF uFlags = 0;
            switch (mode)
            {
            case InitMode.Desktop:
            {
                this.IsFolder     = true;
                this.IsFileSystem = false;
                this.HasSubFolder = true;
            }
            break;

            case InitMode.Path:
            case InitMode.Child:
            {
                uFlags =
                    ShellAPI.SFGAOF.SFGAO_FOLDER |
                    ShellAPI.SFGAOF.SFGAO_FILESYSTEM |
                    ShellAPI.SFGAOF.SFGAO_FILESYSANCESTOR;
                parentSf.GetAttributesOf(1, out pIDL, out uFlags);
                this.IsFolder     = Convert.ToBoolean(uFlags & ShellAPI.SFGAOF.SFGAO_FOLDER);
                this.IsFileSystem = Convert.ToBoolean(uFlags & ShellAPI.SFGAOF.SFGAO_FILESYSTEM);

                if (this.IsFolder)
                {
                    //	GetAttributesOf で SFGAO_HASSUBFOLDER を調べるとかなり遅くなる、
                    //	そもそも this.HasSubFolder はヒントとして使用するだけなのでフォルダの場合は問答無用で
                    //	this.HasSubFolder に true をセットする
                    this.HasSubFolder = true;

                    //	このオブジェクト用の IShellFolder インターフェース取得
                    m_ShellFolder = ShellAPI.BindToIShellFolder(parentSf, pIDL);
                }
            }
            break;
            }

            //	パス名取得
            m_Path = ShellAPI.SHGetPathFromIDList(m_pIDL);

            //	アイコンインデックス番号とかの属性取得
            ShellAPI.SHFILEINFO shInfo = new ShellAPI.SHFILEINFO();
            ShellAPI.SHGetFileInfoW(
                m_pIDL,
                0,
                out shInfo,
                (uint)Marshal.SizeOf(shInfo),
                ShellAPI.SHGFI.SHGFI_SMALLICON |
                ShellAPI.SHGFI.SHGFI_SYSICONINDEX |
                ShellAPI.SHGFI.SHGFI_PIDL |
                ShellAPI.SHGFI.SHGFI_DISPLAYNAME |
                ShellAPI.SHGFI.SHGFI_TYPENAME
                );
            m_DisplayName = shInfo.szDisplayName;
            m_TypeName    = shInfo.szTypeName;
            m_iIconIndex  = shInfo.iIcon;

            //	選択時のアイコンインデックス番号取得
            ShellAPI.SHGetFileInfoW(
                m_pIDL,
                0,
                out shInfo,
                (uint)Marshal.SizeOf(shInfo),
                ShellAPI.SHGFI.SHGFI_PIDL |
                ShellAPI.SHGFI.SHGFI_SMALLICON |
                ShellAPI.SHGFI.SHGFI_SYSICONINDEX |
                ShellAPI.SHGFI.SHGFI_OPENICON
                );
            m_iSelectedIconIndex = shInfo.iIcon;

            //	いろいろ調べてアイテム種類(m_ItemType)を確定する
            if (this.IsFileSystem)
            {
                bool bValidated = false;
                m_FileName = "";

                try
                {
                    m_FileName = System.IO.Path.GetFileName(m_Path);

                    if (this.IsFolder)
                    {
                        if (System.IO.Path.GetPathRoot(m_Path) == m_Path)
                        {
                            //	パス名とルートパスが同じならドライブのはず
                            m_ItemType = ShellItemType.Drive;
                            bValidated = true;
                        }
                        else if (Convert.ToBoolean(uFlags & ShellAPI.SFGAOF.SFGAO_FILESYSANCESTOR))
                        {
                            //	ファイルシステムアイテムを含むことができるフォルダ=ファイルフォルダ(だと思う)
                            m_ItemType = ShellItemType.Folder;
                            bValidated = true;
                        }
                    }
                }
                catch
                {
                    //	システムのアイテムの場合まともなパス名ではなくて、例外が出ちゃうので
                    //	ここで例外キャッチ
                }

                if (!bValidated)
                {
                    m_ItemType = ShellItemType.File;
                    bValidated = true;
                }
            }
            else
            {
                if (this.IsFolder)
                {
                    m_ItemType = ShellItemType.SpecialFolder;
                }
                else
                {
                    m_ItemType = ShellItemType.SpecialItem;
                }
            }
        }
Example #32
0
 static extern void Init(
     IntPtr memory,
     int memorySize,
     InitMode initMode,
     IntPtr setException);