Пример #1
0
        private void MapQueryForm_Load(object sender, EventArgs e)
        {
            RemoteInterface vRemoteInterface = new RemoteInterface();

            m_Layers = vRemoteInterface.GetLayers();
            InitFeatureLayers();
        }
Пример #2
0
        public void AddAviData(RemoteInterface.MFCC.AVIPlateData data)
        {
            foreach(AVI.AVISection sec in sections)
              {

              try
              {
                  sec.AddAviData(data);
              }
              catch (Exception ex)
              {
                  ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
              }

              //if (sec.startTC.devicename == data.DevName)
              //    sec.startTC.AddPlate(data);
              //else if (sec.endTC.devicename == data.DevName)
              //{
              //    sec.endTC.AddPlate(data);
              //    if (sec.startTC.Match(data.plate))
              //    {

              //        TimeSpan ts = data.dt-sec.startTC.GetPlateData(data.plate).dt;
              //        int speed =(int)( System.Math.Abs(sec.endTC.mile_m - sec.startTC.mile_m) / ts.TotalSeconds*3600/1000);
              //        RemoteInterface.ConsoleServer.WriteLine("******"+data.plate + " match!speed="+speed+"km*************");
              //    }
              //}
              }
        }
Пример #3
0
        public void Initialization(object obj)
        {
            System.Windows.Forms.Panel pp = (System.Windows.Forms.Panel)obj;
            remote = new RemoteInterface(true, true);

            iPhysicsDoc = new ExternalAppDock();
            pp.Controls.Add(iPhysicsDoc);
            iPhysicsDoc.Dock = DockStyle.Fill;
            if (!remote.IsStarted)
            {
                remote.StartIPhysics(6001);
            }
            int timeout   = 30000;
            int sleepTime = 500;

            while (!remote.IsConnected && timeout > 0)
            {
                System.Threading.Thread.Sleep(sleepTime);
                timeout -= sleepTime;

                if (!remote.IsConnected)
                {
                    remote.Connect("localhost", 6001);
                }
            }

            iPhysicsDoc.DockExternalApp(remote.ExeProcess, iPhysicsDoc.Parent);
            //if (!(timeout > 0))
            //    throw new Exception("Error, cannot connect to industrialPhysics");
            //Default File Load
            //RegistryKey key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default);
            //String Path = key.GetValue(
            //    "Software\\machineering\\industrialPhysics\\InstallDir(x64)"
            //    , "c:\\Program Files\\machineering\\industrialPhysics(x64)").ToString();
        }
Пример #4
0
        /// <summary>
        /// �]�wCMS���
        /// </summary>
        /// <param name="devNames"></param>
        /// <returns></returns>        
        protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
        {
            System.Collections.Hashtable displayht = new System.Collections.Hashtable();

            List<object> outputs = new List<object>();
            if (devNames == null || devNames.Length == 0) return displayht;

            foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            {
                int distance = getDeviceDistance(devName.SegId, maxSegId);
                DevStartMile = devName.Mileage;
                DevLineID = devName.LineId;
                CMSDevName = devName.DevName;

                outputs = (List<object>)com.select(DBConnect.DataType.CmsCategory, Command.GetSelectCmd.getCMSCategory(Convert.ToInt32(DevRange["RULEID"]), (int)secType, devType.ToString(), distance, devName.DevName, megType.ToString(), ht["INC_LINEID"].ToString().Trim(),devName.Location,devName.LineId));
                foreach (object obj in outputs)
                {
                    List<object> output=new List<object>();
                    output.AddRange(new object[] { getPriority(), obj });
                    if (!displayht.Contains(devName.DevName))
                        displayht.Add(devName.DevName, output);
                    else if (devName.Location == "L")
                    {
                        displayht[devName.DevName] = output;
                    }
                }
            }
            return displayht;
        }
Пример #5
0
        private void button_Query_Click(object sender, EventArgs e)
        {
            string vTownship         = comboBox_Township.Text != "请选择" ? ((ComboBoxListItem)comboBox_Township.SelectedItem).Value : "";
            string vVillageCommittee = comboBox_VillageCommittee.Items.Count > 0 && comboBox_VillageCommittee.Text != "请选择"? ((ComboBoxListItem)comboBox_VillageCommittee.SelectedItem).Value:"";
            string vVillage          = comboBox_Village.Items.Count > 0 && comboBox_Village.Text != "请选择" ? ((ComboBoxListItem)comboBox_Village.SelectedItem).Value : "";
            string vAuthor           = textBox_Author.Text;
            string vFileName         = textBox_File.Text;

            if (vTownship != "" || vVillageCommittee != "" || vVillage != "" || vAuthor != "" || vFileName != "")
            {
                RemoteInterface vRemoteInterface = new RemoteInterface(Program.LoginUserInfo.ID.Value, Program.LoginUserInfo.UserName, Program.LoginUserInfo.Token);
                DataTable       vQueryReuslt     = vRemoteInterface.QueryFile(vTownship, vVillageCommittee, vVillage, vAuthor, vFileName);
                if (vQueryReuslt != null && vQueryReuslt.Rows.Count > 0)
                {
                    dataGridView_FileList.DataSource = vQueryReuslt;
                }
                else
                {
                    dataGridView_FileList.DataSource = null;
                    MessageBox.Show("没有符合条件的数据", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("请至少选择一个查询条件", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #6
0
        protected override System.Collections.Hashtable setWEADisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId)
        {
            System.Collections.Hashtable outputs = new System.Collections.Hashtable();

            byte display = 1;
            switch (secType)
            {
                case 45:    //�@��
                    display = 1;
                    break;
                case 46:    //�j��
                    display = 2;
                    break;
                case 47:    //���B
                    display = 3;
                    break;
                default:    //��L
                    display = 0;
                    break;
            }

            if (devNames == null) return null;
            foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            {
                RemoteInterface.HC.FSOutputData output = new RemoteInterface.HC.FSOutputData(display);
                outputs.Add(devName.DevName, output);
            }
            return outputs;
        }
Пример #7
0
        public HookManager(string libraryName, RemoteInterface remote, params string[] processNames)
        {
            Library = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), libraryName);

            ProcessNames = processNames;
            Remote       = remote;
        }
Пример #8
0
        protected override System.Collections.Hashtable setWEADisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId)
        {
            //serMeg.setAlarmMeg("WIS�T����ƪ���������g��!!");
            System.Collections.Hashtable outputs = new System.Collections.Hashtable();
            string meg = "";
            switch (secType)
            {
                case 45:    //�@��
                    meg = "�@���C��";
                    break;
                case 46:    //�j��
                    meg = "�j���C��";
                    break;
                case 47:    //���B
                    meg = "���B�C��";
                    break;
                default:    //��L
                    meg = "�t�C����";
                    break;
            }
            byte[] colors = new byte[4] { 32, 32, 32, 32 };

            if (devNames == null) return null;
            foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            {
                RemoteInterface.HC.CMSOutputData output = new RemoteInterface.HC.CMSOutputData(0, 0, 0, meg, colors);
                outputs.Add(devName.DevName, output);
            }
            return outputs;
        }
Пример #9
0
        public MainWindow()
        {
            InitializeComponent();
            //bankClient = new RestClient(bankUrl);
            //minerClient = new RestClient(minerUrl);
            //existUsers = new Dictionary<int, uint>();
            sendJobs         = new List <string[]>();
            clientJobResults = new List <string[]>();
            currJobsLogged   = new List <string[]>();

            url     = "https://localhost:44370/";
            webPool = new RestClient(url);

            //create current client connection, AKA this block is the server thread
            currClient      = new ClientDataStruct();
            currClient.ip   = "localhost";
            currClient.port = (new Random().Next(6000, 9999)).ToString("D4");//random generation of port number
            ourServ         = new PeerProgram();
            currClient.port = ourServ.CreateServer(currClient.ip, currClient.port);
            ourRemoteThread = ConnectToRemote(currClient.ip, currClient.port);

            JoinPool();
            ourBlockchain = ourRemoteThread.GetCurrentChain();

            ourAddrText.Text = "Your Client Address is " + currClient.ip + ":" + currClient.port;
            MinerThread();
        }
 public RemoteManager()
 {
     InitializeComponent();
     manager                           = new ManagerHandler(this, managerColour);
     USBDeviceNotifier                 = DeviceNotifier.OpenDeviceNotifier();
     USBDeviceNotifier.Enabled         = false;
     USBDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;
 }
Пример #11
0
        public void Run(RemoteInterface remoteInterface)
        {
            Remote = remoteInterface;

            Thread uiThread = new Thread(StartFrame);

            uiThread.SetApartmentState(ApartmentState.STA);
            uiThread.Start();
        }
Пример #12
0
        /*
         * Algo for synchronising chain with peers most popular chain
         * References: https://www.dotnetperls.com/common-elements-list
         */
        private void SynchroniseChain()
        {
            Dictionary <string, int> hashCount = new Dictionary <string, int>();
            RemoteInterface          ri        = null;

            foreach (ClientDataStruct c in clientList)
            {
                //Console.WriteLine(c.ip + " " + c.port);
                ri = ConnectToRemote(DecodeFrom64(c.ip), DecodeFrom64(c.port));

                string daHash = ri.GetLatestBlock().Hash;

                if (hashCount.TryGetValue(daHash, out int count))
                {
                    hashCount[daHash] = count + 1;
                }
                else //if hash not found yet add it to hashCount
                {
                    if (!daHash.Equals(ourBlockchain.First().Hash))
                    {
                        hashCount.Add(daHash, 1);
                    }
                }
            }


            //if our latest block hash is not the same as most popular then download the most popular chain
            if (hashCount.Count > 0)
            {
                string                maxHash      = hashCount.OrderBy(x => x.Value).Last().Key;//find hash with highest population count
                APIClass.Block        currBlock    = ourRemoteThread.GetLatestBlock();
                List <APIClass.Block> popularChain = null;
                bool found = false;
                //if latest block doesn't have the most popular hash and current block prev hash does not match popular hash then download popular chain
                if (!currBlock.Hash.Equals(maxHash) && !currBlock.PrevHash.Equals(maxHash))
                {
                    foreach (ClientDataStruct c in clientList)
                    {
                        ri           = ConnectToRemote(DecodeFrom64(c.ip), DecodeFrom64(c.port));
                        popularChain = ri.GetCurrentChain();

                        if (ri.GetLatestBlock().Hash.Equals(maxHash))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (found)
                    {
                        ourRemoteThread.SetChain(popularChain);
                        ourBlockchain = ourRemoteThread.GetCurrentChain();
                    }
                }
            }
        }
Пример #13
0
        public void Run(RemoteInterface remoteInterface)
        {
            // Draw 2D text overlay on screen.
            // The X and Y values are coordinates on the screen space, mapped to a 1000x1000 area.
            TextOverlay hello  = new TextOverlay("Hello World", 10, 5, 5).Show();
            TextOverlay colors = new TextOverlay("This text is red and transparent".Red(), 10, 5, 30, 180).Show();

            // Use RemoteInterface.Log() to display text in the mod loader console.
            remoteInterface.Log("Hello World");
        }
Пример #14
0
        public static void InitGlobalHooks(RemoteInterface remoteInterface)
        {
            GlobalHookManager = new HookManager();

            GlobalActions.Interface = remoteInterface;

            GlobalHookManager.CreateHook(EngineFunctions.VEngine, GlobalActions.HVEngine);
            GlobalHookManager.CreateHook(TextFunctions.DrawsTexts, GlobalActions.HDrawsTexts);
            GlobalHookManager.CreateHook(InputFunctions.VirtualKeyToAscii, GlobalInput.HVirtualKeyToAscii);
        }
Пример #15
0
        public double GetVolume()
        {
            object o = RemoteInterface.GetProperty(3, "x-canonical-ido-volume-level");

            if (o != null)
            {
                Volume = Convert.ToDouble(o);
                return(Volume);
            }
            return(0);
        }
Пример #16
0
        /// <summary>
        /// if sound is not muted sound will be muted
        /// if the sound is muted it will be unmuted
        /// </summary>
        public void Mute()
        {
            EventGroupData data = new EventGroupData
            {
                data1 = 2,
                data2 = "clicked",
                data3 = 0,
                data4 = 18227741
            };

            RemoteInterface.EventGroup(new EventGroupData[] { data });
        }
Пример #17
0
 protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
 {
     System.Collections.Hashtable displayht = new System.Collections.Hashtable();
     foreach (RemoteInterface.HC.FetchDeviceData dev in devNames)
     {
         if (!displayht.ContainsKey(dev.DevName))
         {
             displayht.Add(dev.DevName, null);
         }
     }
     return displayht;
 }
Пример #18
0
        private RemoteInterface ConnectToRemote(string ip, string port)//connect to remote server
        {
            ChannelFactory <RemoteInterface> foobFactory;
            NetTcpBinding tcp = new NetTcpBinding();

            string URL = "net.tcp://" + ip + ":" + port + "/DataService";

            foobFactory = new ChannelFactory <RemoteInterface>(tcp, URL);
            RemoteInterface foob = foobFactory.CreateChannel();

            return(foob);
        }
Пример #19
0
        private void button_Upload_Click(object sender, EventArgs e)
        {
            RemoteInterface vRemoteInterface = new RemoteInterface(Program.LoginUserInfo.ID.Value,
                                                                   Program.LoginUserInfo.UserName, Program.LoginUserInfo.Token);
            int    vUserID = Program.LoginUserInfo.ID.Value;
            string vToken  = Program.LoginUserInfo.Token;

            string vAuthor = "";

            if (textBox_Author.Text != "")
            {
                vAuthor = textBox_Author.Text;
            }
            else
            {
                MessageBox.Show("请输入作者名称", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string vFilePath = "";

            if (textBox_File.Text != "" && System.IO.File.Exists(textBox_File.Text))
            {
                vFilePath = textBox_File.Text;
            }
            else
            {
                MessageBox.Show("请选择文件或者选择的文件不存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string vAreaCode = "";
            string vUnitName = "";

            getSelectedAreaCode(ref vAreaCode, ref vUnitName);
            if (vAreaCode == "")
            {
                MessageBox.Show("请选择需要上传文件的单位", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            bool vResult = vRemoteInterface.UploadFile(vFilePath, vAuthor, vAreaCode, vUnitName);

            if (vResult)
            {
                MessageBox.Show("文件上传成功", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_File.Text = "";
            }
            else
            {
                MessageBox.Show("文件上传失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #20
0
 public void InitFileInfo()
 {
     if (AreaCodeArray != null)
     {
         RemoteInterface vRemoteInterface = new RemoteInterface(Program.LoginUserInfo.ID.Value, Program.LoginUserInfo.UserName, Program.LoginUserInfo.Token);
         FileInfo[]      vFileInfoArray   = vRemoteInterface.GetFiles(AreaCodeArray);
         if (vFileInfoArray != null)
         {
             dataGridView_FileList.AutoGenerateColumns = false;
             dataGridView_FileList.DataSource          = vFileInfoArray;
         }
     }
 }
        unsafe void IMod.Run(RemoteInterface remoteInterface)
        {
            ri = remoteInterface;

            ri.Log("Rayman 2 Tank Controls");

            w = new World();

            hm = new HookManager();
            hm.CreateHook(EngineFunctions.fn_p_stReadAnalogJoystickMario, MarioFunction);
            hm.CreateHook(InputFunctions.VReadInput, ReadInputFunction);
            object p = hm.CreateHook(EngineFunctions.PLA_fn_bSetNewState, PLA_fn_bSetNewState);
        }
Пример #22
0
        /// <summary>
        /// set the volume
        /// </summary>
        /// <param name='volume'>
        /// value between 0 and 100
        /// </param>
        public void SetVolume(double volume)
        {
            //Dictionary<string, object> dt = new Dictionary<string, object>(100);

            EventGroupData data = new EventGroupData
            {
                data1 = 3,
                data2 = "change-volume",
                data3 = volume,
                data4 = 0
            };

            RemoteInterface.EventGroup(new EventGroupData[] { data });
        }
Пример #23
0
        //初始化
        public void Initialization()
        {
            remote = new RemoteInterface(true, true);

            iPhysicsDoc = new ExternalAppDock();
            this.panel1.Controls.Add(iPhysicsDoc);
            iPhysicsDoc.Dock = DockStyle.Fill;
            if (!remote.IsStarted)
            {
                remote.StartIPhysics(6001);
            }
            int timeout   = 30000;
            int sleepTime = 500;

            while (!remote.IsConnected && timeout > 0)
            {
                System.Threading.Thread.Sleep(sleepTime);
                timeout -= sleepTime;

                if (!remote.IsConnected)
                {
                    remote.Connect("localhost", 6001);
                }
            }

            iPhysicsDoc.DockExternalApp(remote.ExeProcess, iPhysicsDoc.Parent);
            if (!(timeout > 0))
            {
                throw new Exception("Error, cannot connect to industrialPhysics");
            }
            //Default File Load
            RegistryKey key  = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default); //  = new Microsoft.Win32.RegistryKey();
            String      Path = key.GetValue(
                "Software\\machineering\\industrialPhysics\\InstallDir(x64)"
                , "c:\\Program Files\\machineering\\industrialPhysics(x64)").ToString();
            //IPhysics_Command command = new LoadDocument(Environment.CurrentDirectory + "../../../../AGV_Path.iphz");
            //textBox1.Text = Environment.CurrentDirectory + "/AGV_Path.iphz";
            IPhysics_Command command = new LoadDocument(Environment.CurrentDirectory + "/cgk_csharp.iphz");

            remote.execute(command);

            remote.lookFromIsometry();
            //remote.switchModePresentation(true);
            remote.zoomOut(0);
            //remote.sendPlay();
            loading_done = true;
            //remote.sendReset();
            //remote.sendPlay();
        }
        private void addSentCQMessage(String message, RemoteInterface handler)
        {
            ListViewItem item = makeBaseMessageItem(message, false);

            if (handler == null)
            {
                item.BackColor = automatedColor;
            }
            else
            {
                item.BackColor = handler.HandlerColor;
            }
            addCQMessageToSpecificList(item, getListViewByHandler(handler));
            addCQMessageToList(item);
        }
Пример #25
0
        public void Initialization(object obj)
        {
            System.Windows.Forms.Panel pp = (System.Windows.Forms.Panel)obj;
            remote = new RemoteInterface(false, true);

            iPhysicsDoc = new ExternalAppDock();
            pp.Controls.Add(iPhysicsDoc);
            iPhysicsDoc.Dock = DockStyle.Fill;
            if (!remote.IsStarted)
            {
                remote.StartIPhysics(decimal.Parse(System.Configuration.ConfigurationManager.AppSettings["modeport"].ToString()));
            }
            int timeout   = 30000;
            int sleepTime = 500;

            while (!remote.IsConnected && timeout > 0)
            {
                System.Threading.Thread.Sleep(sleepTime);
                timeout -= sleepTime;

                if (!remote.IsConnected)
                {
                    remote.Connect("localhost", int.Parse(System.Configuration.ConfigurationManager.AppSettings["modeport"].ToString()));
                }
            }

            iPhysicsDoc.DockExternalApp(remote.ExeProcess, iPhysicsDoc.Parent);
            if (!(timeout > 0))
            {
                throw new Exception("Error, cannot connect to industrialPhysics");
            }
            //Default File Load
            RegistryKey key  = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default);
            String      Path = key.GetValue(
                "Software\\machineering\\industrialPhysics\\InstallDir(x64)"
                , "c:\\Program Files\\machineering\\industrialPhysics(x64)").ToString();

            //IPhysics_Command command = new LoadDocument(Environment.CurrentDirectory + "/light.iphz");
            //remote.execute(command);
            //remote.lookFromIsometry();
            //remote.switchModePresentation(true);
            //remote.zoomOut(0);
            //remote.sendPlay();
            //loading_done = true;
            //remote.sendReset();
            //remote.sendPlay();
            initializ_done = true;
        }
Пример #26
0
        public void NotifyAll(RemoteInterface.NotifyEventObject notifyObj)
        {
            //  int cnt = 0;
            // ���n�ɸѰ�����
               // System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(DoNotifyAllWork));
              //  th.Start(notifyObj);

               notifyQueue.Enqueue(notifyObj);
               lock (notifyQueue)
               {

                 System.Threading.Monitor.Pulse(notifyQueue);
               }

               // return cnt;
        }
Пример #27
0
        /*
         * whenever there are 5 jobs, broadcast this to all nearby peers
         */
        private void BroadcastTransaction()
        {
            if (sendJobs.Count == 5)
            {
                string sendSnippet = JsonConvert.SerializeObject(sendJobs);

                ourRemoteThread.ReceiveTransaction(sendSnippet);

                foreach (ClientDataStruct c in clientList)
                {
                    Console.WriteLine(c.ip + " " + c.port);
                    RemoteInterface ri = ConnectToRemote(DecodeFrom64(c.ip), DecodeFrom64(c.port));

                    ri.ReceiveTransaction(sendSnippet);//broadcast to each client in pool
                }

                sendJobs.Clear();//clear list once transactions sent off
            }
        }
Пример #28
0
        private void dataGridView_FileList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                RemoteInterface vRemoteInterface = new RemoteInterface(Program.LoginUserInfo.ID.Value, Program.LoginUserInfo.UserName, Program.LoginUserInfo.Token);
                DataTable       vDatsSource      = (DataTable)dataGridView_FileList.DataSource;
                int             vFileID          = (int)vDatsSource.Rows[e.RowIndex]["ID"];
                string          vFileName        = (string)vDatsSource.Rows[e.RowIndex]["FileName"];
                if (e.ColumnIndex == 5)
                {
                    ConfigFile vConfigFile   = new ConfigFile();
                    string     vDownloadPath = string.Format(@"{0}\{1}", vConfigFile.DownloadPath, vFileName);

                    if (vRemoteInterface.DownloadFile(vFileID, vDownloadPath))
                    {
                        if (MessageBox.Show("文件下载成功,是否打开?", "信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                        {
                            System.Diagnostics.Process.Start(vDownloadPath);
                        }
                    }
                    else
                    {
                        MessageBox.Show("文件下载失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                if (e.ColumnIndex == 6)
                {
                    if (MessageBox.Show("是否确认删除", "信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                    {
                        if (vRemoteInterface.DeleteFile(vFileID, vFileName))
                        {
                            dataGridView_FileList.Rows.RemoveAt(e.RowIndex);
                            ((DataTable)dataGridView_FileList.DataSource).Rows.RemoveAt(e.RowIndex);
                            ((DataTable)dataGridView_FileList.DataSource).AcceptChanges();
                        }
                        else
                        {
                            MessageBox.Show("删除文件失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
 private void sendCommand(String command, RemoteInterface handler)
 {
     if ((handler != null) && (handler.UsedSCHandler != TS3ClientStuff.UsedSCHandler))
     {
         sendCommand("use " + handler.UsedSCHandler, null);
     }
     addSentCQMessage(command, handler);
     CommandHistory.Add(new CommandLog(command, handler));
     try
     {
         TS3ClientStuff.send(command.Trim() + '\r' + '\n');
     }
     catch (HandlerException ex)
     {
         TS3ClientConnect();
         TS3ClientStuff.send(command.Trim() + '\r' + '\n');
     }
     keepAlive.addSleepTime();
 }
        private ListView getListViewByHandler(RemoteInterface handler)
        {
            if (handler == null)
            {
                return(AutoMessageView);
            }
            if (handler.getID() == -1)
            {
                return(managerCQMessages);
            }
            String pageName = "RemotePage" + handler.getID();

            if (MessageTabControl.TabPages.ContainsKey(pageName))
            {
                TabPage page = MessageTabControl.TabPages[MessageTabControl.TabPages.IndexOfKey("RemotePage" + handler.getID())];
                return((ListView)page.Controls[page.Controls.IndexOfKey("Remote" + handler.getID() + "CQMessages")]);
            }

            return(null);
        }
Пример #31
0
        public void Run(RemoteInterface remoteInterface)
        {
            Interface = remoteInterface;

            // Regular, static text.
            // The X and Y values are coordinates on the screen space, mapped to a 1000x1000 area.
            TextOverlay plain = new TextOverlay("Regular text", 10, 5, 5).Show();

            // Dynamically updating text.
            // The delegate TextOverlay.UpdateText is evaluated on every frame (if assigned).
            // It can be assigned instead of text in the constructor, or later at any point.
            int         frames  = 0;
            TextOverlay counter = new TextOverlay((previousText) =>
            {
                string newText = $"Frame counter={frames}";
                frames++;
                return(newText);
            }, 10, 5, 35).Show();

            // Previous text is passed to the UpdateText method as a parameter.
            // This example appends 1 dot to the text every 10 frames, up to a total of 20.
            // It also uses the frame counter from the previous example.
            int         dots   = 0;
            TextOverlay append = new TextOverlay("Some dots", 10, 5, 65).Show();

            append.UpdateText = (text) =>
            {
                if (frames % 10 == 0 && dots < 20)
                {
                    text += '.';
                    dots++;
                }
                return(text);
            };

            // The delegate TextOverlay.UpdateProperties can be used for advanced text manipulation.
            // It is evaluated on every frame, after UpdateText.
            // The TextOverlay object itself is passed as a parameter.
            // This lets you reuse functions and delegates for multiple text objects.
            plain.UpdateProperties = MoveTextOffscreen;
        }
Пример #32
0
        /// <summary>
        /// �]�wCMS���
        /// </summary>
        /// <param name="devNames"></param>
        /// <returns></returns>        
        protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
        {
            System.Collections.Hashtable displayht = new System.Collections.Hashtable();

            List<object> outputs = new List<object>();
            if (devNames == null) return displayht;

            foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            {
                int distance = getDeviceDistance(devName.SegId, maxSegId);

                outputs = (List<object>)com.select(DBConnect.DataType.CmsCategory, Command.GetSelectCmd.getCMSCategory(Convert.ToInt32(DevRange["RULEID"]), (int)secType, devType.ToString(), distance, devName.DevName, megType.ToString(), ht["INC_LINEID"].ToString().Trim()));
                foreach (object obj in outputs)
                {
                    List<object> output=new List<object>();
                    output.AddRange(new object[] { getPriority(), obj });
                    displayht.Add(devName.DevName, output);
                }
            }
            return displayht;
        }
Пример #33
0
        public FrmNotifyFinishDialog(RemoteInterface.NotifyMessage[] mesgs)
        {
            InitializeComponent();
            this.origmesgs = mesgs;

             this.mesgs = new NotifyMessage[mesgs.Length];
             for (int i = 0; i < origmesgs.Length; i++)
             {
                 this.mesgs[i] = origmesgs[i].Clone();
             }

             foreach (Control ctl in this.Controls)
             {
                 if (ctl is CheckBox)
                 {
                     if (Convert.ToInt32(ctl.Tag) < mesgs.Length)
                         (ctl as CheckBox).Checked = mesgs[Convert.ToInt32(ctl.Tag)].IsFinish;
                     else
                         ctl.Visible = false;
                 }
             }
        }
Пример #34
0
        public Clientes()
        {
            InitializeComponent();


            try
            {
                TcpChannel chan = new TcpChannel();
                ChannelServices.RegisterChannel(chan);

                // Create an instance of the remote object
                obj = (RemoteInterface)Activator.GetObject(typeof(RemoteInterface), "tcp://localhost:8888/calculadora");
            }
            catch
            {
                // localhost  OR your server name
                if (obj.Equals(null))
                {
                    System.Console.WriteLine("Error: unable to locate server");
                }
            }
        }
Пример #35
0
        public void Run(RemoteInterface remoteInterface)
        {
            // Static addresses can be directly assigned to an unsafe pointer.
            byte *engineState = (byte *)0x500380;

            // Pointer/offset paths can be read at runtime using Memory.GetPointerAtOffset.
            Vector3 *position = (Vector3 *)Memory.GetPointerAtOffset(0x500560, 0x224, 0x310, 0x34, 0x0, 0x1ac);

            // Display values as in-game text.
            TextOverlay state = new TextOverlay((current) => $"EngineState={*engineState}", 10, 5, 200).Show();

            TextOverlay coordinates = new TextOverlay((current) =>
            {
                // Utils.TextUtils provides many extension methods that simplify in-game text formatting.
                // The second line of the string is equivalent to:
                // "/O200:X/O0:\\" + (position->X).ToString("0.000", CultureInfo.InvariantCulture) + "/l:"
                string text = "Coordinates=".NL() +
                              "X".KeyValue(position->X.D3()).NL() +
                              "Y".KeyValue(position->Y.D3()).NL() +
                              "Z".KeyValue(position->Z.D3()).NL();
                return(text);
            }, 10, 5, 5).Show();
        }
Пример #36
0
 private void dataGridView_FileList_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 4)
     {
         FileInfo[]      vDatsSource      = (FileInfo[])dataGridView_FileList.DataSource;
         int             vFileID          = vDatsSource[e.RowIndex].ID;
         string          vFileName        = vDatsSource[e.RowIndex].FileName;
         ConfigFile      vConfigFile      = new ConfigFile();
         string          vDownloadPath    = string.Format(@"{0}\{1}", vConfigFile.DownloadPath, vFileName);
         RemoteInterface vRemoteInterface = new RemoteInterface(Program.LoginUserInfo.ID.Value, Program.LoginUserInfo.UserName, Program.LoginUserInfo.Token);
         if (vRemoteInterface.DownloadFile(vFileID, vDownloadPath))
         {
             if (MessageBox.Show("文件下载成功,是否打开?", "信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
             {
                 System.Diagnostics.Process.Start(vDownloadPath);
             }
         }
         else
         {
             MessageBox.Show("文件下载失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Пример #37
0
        public void Initialization(object obj)
        {
            System.Windows.Forms.Panel pp = (System.Windows.Forms.Panel)obj;
            remote = new RemoteInterface(false, false);

            iPhysicsDoc = new ExternalAppDock();
            pp.Controls.Add(iPhysicsDoc);
            iPhysicsDoc.Dock = DockStyle.Fill;
            if (!remote.IsStarted)
            {
                remote.StartIPhysics(decimal.Parse(System.Configuration.ConfigurationManager.AppSettings["modeport_browser"].ToString()));
            }
            int timeout   = 30000;
            int sleepTime = 500;

            while (!remote.IsConnected && timeout > 0)
            {
                System.Threading.Thread.Sleep(sleepTime);
                timeout -= sleepTime;

                if (!remote.IsConnected)
                {
                    remote.Connect("localhost", int.Parse(System.Configuration.ConfigurationManager.AppSettings["modeport_browser"].ToString()));
                }
            }

            iPhysicsDoc.DockExternalApp(remote.ExeProcess, iPhysicsDoc.Parent);
            if (!(timeout > 0))
            {
                throw new Exception("Error, cannot connect to industrialPhysics");
            }
            //Default File Load
            RegistryKey key  = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default);
            String      Path = key.GetValue(
                "Software\\machineering\\industrialPhysics\\InstallDir(x64)"
                , "c:\\Program Files\\machineering\\industrialPhysics(x64)").ToString();
        }
Пример #38
0
        public void Hook()
        {
            if (IsHooked)
                return;

            var ri = new RemoteInterface
            {
                //Wrap the target delegate in our own delegate for reference safety
                SystemId = (x, y) => _systemDeviceId(x, y),
                Unload = () => !IsHooked,
                ErrorHandler = RaiseOnError
            };

            RemoteHooking.IpcCreateServer(ref _channelName, WellKnownObjectMode.Singleton, ri);

            RemoteHooking.Inject(
                _processId,
                InjectionOptions.DoNotRequireStrongName,
                typeof (IMMDeviceEnumerator).Assembly.Location,
                typeof (IMMDeviceEnumerator).Assembly.Location,
                _channelName);

            IsHooked = true;
        }
Пример #39
0
        void nclient_OnEvent(RemoteInterface.NotifyEventObject objEvent)
        {
            //throw new Exception("The method or operation is not implemented.");
            try
            {
                if (objEvent.type == RemoteInterface.EventEnumType.RGS_Connection_Event)
                {
                    QYTask.Ds.tblRGSMainRow r = ds.tblRGSMain.FindByip(objEvent.devip);

                    r.connected = (bool)objEvent.EventObj;
                    r.EndEdit();
                    r.AcceptChanges();
                }
                else if (objEvent.type == RemoteInterface.EventEnumType.RGS_HW_Status_Event)
                {
                   I_HW_Status_Desc hw_desc = (I_HW_Status_Desc)objEvent.EventObj;
                    QYTask.Ds.tblRGSMainRow r = ds.tblRGSMain.FindByip(objEvent.devip);
                    System.Collections.IEnumerator ie = hw_desc.getEnum().GetEnumerator();
                    while (ie.MoveNext())
                    {
                        if ((int)ie.Current == 1 || (int)ie.Current == 0 || (int)ie.Current == 8 || (int)ie.Current == 9 || (int)ie.Current == 10 || (int)ie.Current == 11)
                            r[hw_desc.getDesc((int)ie.Current)] = hw_desc.getStatus((int)ie.Current);
                        r.EndEdit();
                        r.AcceptChanges();
                    }

                }
            }
            catch (System.Data.DataException)
            {
            }
            catch (Exception )
            {
                // MessageBox.Show(ex.Message);
            }
        }
Пример #40
0
        public void Run(RemoteInterface remoteInterface)
        {
            // All particles, HUD icons and other GFX objects should always be drawn in the main engine loop.
            GlobalActions.Engine += () =>
            {
                // Create 2 vectors - upper-left and lower-right corner of the icon.
                // For HUD icons, the screen space is mapped to a 100x100 area.
                // Only X and Y coordinates are used to position the icon.
                // The Z coordinate of the 2nd vector is the alpha/transparency value.
                Vector3 vPos1 = new Vector3(5, 5, 0);
                Vector3 vPos2 = new Vector3(20, 20, 255);

                // StructPtr copies the vector structure to unmanaged memory and provides a pointer.
                // The memory is freed automatically at the end of the using block.
                using (StructPtr pos1 = new StructPtr(vPos1), pos2 = new StructPtr(vPos2))
                {
                    // Particle type 125 is the HUD icon type.
                    // The last parameter "a6" varies between particle types - in this case it's an index.
                    // A specific index value can only be used by one icon. If multiple icons are drawn
                    // with the same index, only the last one will be displayed.
                    GfxFunctions.VAddParticle.Call(125, pos1, pos2, TexturePointers.rayIcon, 11);
                }
            };
        }
Пример #41
0
        internal MainForm(string strView,
            string strGeoTiff, string strGeotiffName, bool bGeotiffTmp,
            string strKMLFile, string strKMLName, bool blKMLTmp,
            string strLastView, Dapple.Extract.Options.Client.ClientType eClientType, RemoteInterface oMRI, GeographicBoundingBox oAoi, string strAoiCoordinateSystem, string strMapFileName)
        {
            if (String.Compare(Path.GetExtension(strView), ViewExt, true) == 0 && File.Exists(strView))
                this.openView = strView;

            m_strOpenGeoTiffFile = strGeoTiff;
            m_strOpenGeoTiffName = strGeotiffName;
            m_blOpenGeoTiffTmp = bGeotiffTmp;

            m_strOpenKMLFile = strKMLFile;
            m_strOpenKMLName = strKMLName;
            m_blOpenKMLTmp = blKMLTmp;

            this.lastView = strLastView;
            s_oMontajRemoteInterface = oMRI;

            // Establish the version number string used for user display,
            // such as the Splash and Help->About screens.
            // To change the Application.ProductVersion make the
            // changes in \WorldWind\AssemblyInfo.cs
            // For alpha/beta versions, include " alphaN" or " betaN"
            // at the end of the format string.
            Version ver = new Version(Application.ProductVersion);
            Release = string.Format(CultureInfo.InvariantCulture, "{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
            if (ver.Build % 2 != 0)
                Release += " (BETA)";

            // Name the main thread.
            System.Threading.Thread.CurrentThread.Name = ThreadNames.EventDispatch;

            // Copy/Update any configuration files and other files if needed now
            CurrentSettingsDirectory = Path.Combine(UserPath, "Config");
            Directory.CreateDirectory(CurrentSettingsDirectory);
            Settings.CachePath = Path.Combine(UserPath, "Cache");
            Directory.CreateDirectory(Settings.CachePath);
            this.metaviewerDir = Path.Combine(UserPath, "Metadata");
            Directory.CreateDirectory(this.metaviewerDir);
            string[] cfgFiles = Directory.GetFiles(Path.Combine(DirectoryPath, "Config"), "*.xml");
            foreach (string strCfgFile in cfgFiles)
            {
                string strUserCfg = Path.Combine(CurrentSettingsDirectory, Path.GetFileName(strCfgFile));
                if (!File.Exists(strUserCfg))
                    File.Copy(strCfgFile, strUserCfg);
            }
            string[] metaFiles = Directory.GetFiles(Path.Combine(Path.Combine(DirectoryPath, "Data"), "MetaViewer"), "*.*");
            foreach (string strMetaFile in metaFiles)
            {
                string strUserMeta = Path.Combine(this.metaviewerDir, Path.GetFileName(strMetaFile));
                File.Copy(strMetaFile, strUserMeta, true);
            }

            // --- Set up a new user's favorites list and home view ---

            /*if (!File.Exists(Path.Combine(CurrentSettingsDirectory, "user.dapple_serverlist")))
            {
                File.Copy(Path.Combine(Path.Combine(DirectoryPath, "Data"), "default.dapple_serverlist"), Path.Combine(CurrentSettingsDirectory, "user.dapple_serverlist"));
            }*/
            HomeView.CreateDefault();

            InitSettings();

            if (Settings.NewCachePath.Length > 0)
            {
                try
                {
                    // We want to make sure the new cache path is writable
                    Directory.CreateDirectory(Settings.NewCachePath);
                    if (Directory.Exists(Settings.CachePath))
                        Utility.FileSystem.DeleteFolderGUI(this, Settings.CachePath, "Deleting Existing Cache");
                    Settings.CachePath = Settings.NewCachePath;
                }
                catch
                {
                }
                Settings.NewCachePath = "";
            }

            if (Settings.ConfigurationWizardAtStartup)
            {
                Wizard frm = new Wizard(Settings);
                frm.ShowDialog(this);
                Settings.ConfigurationWizardAtStartup = false;
            }

            if (Settings.ConfigurationWizardAtStartup)
            {
                // If the settings file doesn't exist, then we are using the
                // default settings, and the default is to show the Configuration
                // Wizard at startup. We only want that to happen the first time
                // World Wind is started, so change the setting to false(the user
                // can change it to true if they want).
                if (!File.Exists(Settings.FileName))
                {
                    Settings.ConfigurationWizardAtStartup = false;
                }
                ConfigurationWizard.Wizard wizard = new ConfigurationWizard.Wizard(Settings);
                wizard.TopMost = true;
                wizard.ShowInTaskbar = true;
                wizard.ShowDialog();
                // TODO: should settings be saved now, in case of program crashes,
                //	   and so that XML file on disk matches in-memory settings?
            }

            //#if !DEBUG
            using (this.splashScreen = new Splash())
            {
                this.splashScreen.Owner = this;
                this.splashScreen.Show();

                Application.DoEvents();
                //#endif

                // --- setup the list of images used for the different datatypes ---

                s_oImageList.ColorDepth = ColorDepth.Depth32Bit;
                s_oImageList.ImageSize = new Size(16, 16);
                s_oImageList.TransparentColor = Color.Transparent;

                s_oImageList.Images.Add(EnabledServerIconKey, Resources.enserver);
                s_oImageList.Images.Add(DisabledServerIconKey, Resources.disserver);
                s_oImageList.Images.Add(OfflineServerIconKey, Resources.offline);
                s_oImageList.Images.Add(DapIconKey, Resources.dap);
                s_oImageList.Images.Add(DapDatabaseIconKey, Resources.dap_database);
                s_oImageList.Images.Add(DapDocumentIconKey, Resources.dap_document);
                s_oImageList.Images.Add(DapGridIconKey, Resources.dap_grid);
                s_oImageList.Images.Add(DapMapIconKey, Resources.dap_map);
                s_oImageList.Images.Add(DapPictureIconKey, Resources.dap_picture);
                s_oImageList.Images.Add(DapPointIconKey, Resources.dap_point);
                s_oImageList.Images.Add(DapSpfIconKey, Resources.dap_spf);
                s_oImageList.Images.Add(DapVoxelIconKey, Resources.dap_voxel);
                s_oImageList.Images.Add(FolderIconKey, Resources.folder);
                s_oImageList.Images.Add(DapArcGisIconKey, global::Dapple.Properties.Resources.dap_arcgis);
                s_oImageList.Images.Add(KmlIconKey, Resources.kml);
                s_oImageList.Images.Add(ErrorIconKey, global::Dapple.Properties.Resources.error);
                s_oImageList.Images.Add(LayerIconKey, global::Dapple.Properties.Resources.layer);
                s_oImageList.Images.Add(LiveMapsIconKey, global::Dapple.Properties.Resources.live);
                s_oImageList.Images.Add(TileIconKey, global::Dapple.Properties.Resources.tile);
                s_oImageList.Images.Add(GeorefImageIconKey, global::Dapple.Properties.Resources.georef_image);
                s_oImageList.Images.Add(WmsIconKey, Resources.wms);
                s_oImageList.Images.Add(ArcImsIconKey, global::Dapple.Properties.Resources.arcims);
                s_oImageList.Images.Add(BlueMarbleIconKey, Dapple.Properties.Resources.blue_marble);
                s_oImageList.Images.Add(DesktopCatalogerIconKey, Dapple.Properties.Resources.dcat);

                c_oWorldWindow = new WorldWindow();
            #if !DEBUG
                Utility.AbortUtility.ProgramAborting += new MethodInvoker(c_oWorldWindow.KillD3DAndWorkerThread);
            #endif
                c_oWorldWindow.AllowDrop = true;
                c_oWorldWindow.DragOver += new DragEventHandler(c_oWorldWindow_DragOver);
                c_oWorldWindow.DragDrop += new DragEventHandler(c_oWorldWindow_DragDrop);
                c_oWorldWindow.Resize += new EventHandler(c_oWorldWindow_Resize);
                InitializeComponent();
                this.SuspendLayout();
                c_oLayerList.ImageList = s_oImageList;

            /*#if DEBUG
                // --- Make the server tree HOOGE ---
                this.splitContainerMain.SplitterDistance = 400;
                this.splitContainerLeftMain.SplitterDistance = 400;
            #endif*/

                this.Icon = new System.Drawing.Icon(@"app.ico");
                DappleToolStripRenderer oTSR = new DappleToolStripRenderer();
                c_tsSearch.Renderer = oTSR;
                c_tsLayers.Renderer = oTSR;
                c_tsOverview.Renderer = oTSR;
                c_tsMetadata.Renderer = oTSR;

                c_tsNavigation.Renderer = new BorderlessToolStripRenderer();

                // set Upper and Lower limits for Cache size control, in bytes
                long CacheUpperLimit = (long)Settings.CacheSizeGigaBytes * 1024L * 1024L * 1024L;
                long CacheLowerLimit = (long)Settings.CacheSizeGigaBytes * 768L * 1024L * 1024L;	//75% of upper limit

                try
                {
                    Directory.CreateDirectory(Settings.CachePath);
                }
                catch
                {
                    // We get here when people used a cache drive that since dissappeared (e.g. USB flash)
                    // Revert to default cache directory in this case

                    Settings.CachePath = Path.Combine(UserPath, "Cache");
                    Directory.CreateDirectory(Settings.CachePath);
                }

                //Set up the cache
                c_oWorldWindow.Cache = new Cache(
                    Settings.CachePath,
                    CacheLowerLimit,
                    CacheUpperLimit,
                    Settings.CacheCleanupInterval,
                    Settings.TotalRunTime);

                #region Plugin + World Init.

                WorldWind.Terrain.TerrainTileService terrainTileService = new WorldWind.Terrain.TerrainTileService("http://worldwind25.arc.nasa.gov/wwelevation/wwelevation.aspx", "srtm30pluszip", 20, 150, "bil", 12, Path.Combine(Settings.CachePath, "Earth\\TerrainAccessor\\SRTM"), TimeSpan.FromMinutes(30), "Int16");
                WorldWind.Terrain.TerrainAccessor terrainAccessor = new WorldWind.Terrain.NltTerrainAccessor("SRTM", -180, -90, 180, 90, terrainTileService, null);

                WorldWind.World world = new WorldWind.World("Earth",
                    new Point3d(0, 0, 0), Quaternion4d.RotationYawPitchRoll(0, 0, 0),
                    (float)6378137,
                    System.IO.Path.Combine(c_oWorldWindow.Cache.CacheDirectory, "Earth"),
                    terrainAccessor);

                c_oWorldWindow.CurrentWorld = world;
                c_oWorldWindow.DrawArgs.WorldCamera.CameraChanged += new EventHandler(c_oWorldWindow_CameraChanged);

                string strPluginsDir = Path.Combine(DirectoryPath, "Plugins");

                this.scalebarPlugin = new NASA.Plugins.ScaleBarLegend();
                this.scalebarPlugin.PluginLoad(this, strPluginsDir);
                this.scalebarPlugin.IsVisible = World.Settings.ShowScaleBar;

                this.starsPlugin = new Stars3D.Plugin.Stars3D();
                this.starsPlugin.PluginLoad(this, Path.Combine(strPluginsDir, "Stars3D"));

                this.compassPlugin = new Murris.Plugins.Compass();
                this.compassPlugin.PluginLoad(this, Path.Combine(strPluginsDir, "Compass"));

                String szGlobalCloudsCacheDir = Path.Combine(Settings.CachePath, @"Plugins\GlobalClouds");
                Directory.CreateDirectory(szGlobalCloudsCacheDir);
                String szGlobalCloudsPluginDir = Path.Combine(CurrentSettingsDirectory, @"Plugins\GlobalClouds");
                Directory.CreateDirectory(szGlobalCloudsPluginDir);

                if (!File.Exists(Path.Combine(szGlobalCloudsPluginDir, Murris.Plugins.GlobalCloudsLayer.serverListFileName)))
                {
                    File.Copy(Path.Combine(Path.Combine(strPluginsDir, "GlobalClouds"), Murris.Plugins.GlobalCloudsLayer.serverListFileName), Path.Combine(szGlobalCloudsPluginDir, Murris.Plugins.GlobalCloudsLayer.serverListFileName));
                }

                this.cloudsPlugin = new Murris.Plugins.GlobalClouds(szGlobalCloudsCacheDir);
                this.cloudsPlugin.PluginLoad(this, szGlobalCloudsPluginDir);

                this.skyPlugin = new Murris.Plugins.SkyGradient();
                this.skyPlugin.PluginLoad(this, Path.Combine(strPluginsDir, "SkyGradient"));

                this.threeDConnPlugin = new ThreeDconnexion.Plugin.TDxWWInput();
                this.threeDConnPlugin.PluginLoad(this, Path.Combine(strPluginsDir, "3DConnexion"));

                ThreadPool.QueueUserWorkItem(LoadPlacenames);

                c_scWorldMetadata.Panel1.Controls.Add(c_oWorldWindow);
                c_oWorldWindow.Dock = DockStyle.Fill;

                #endregion

                float[] verticalExaggerationMultipliers = { 0.0f, 1.0f, 1.5f, 2.0f, 3.0f, 5.0f, 7.0f, 10.0f };
                foreach (float multiplier in verticalExaggerationMultipliers)
                {
                    ToolStripMenuItem curItem = new ToolStripMenuItem(multiplier.ToString("f1", System.Threading.Thread.CurrentThread.CurrentCulture) + "x", null, new EventHandler(menuItemVerticalExaggerationChange));
                    c_miVertExaggeration.DropDownItems.Add(curItem);
                    curItem.CheckOnClick = true;
                    if (Math.Abs(multiplier - World.Settings.VerticalExaggeration) < 0.1f)
                        curItem.Checked = true;
                }

                this.c_miShowCompass.Checked = World.Settings.ShowCompass;
                this.c_miShowDLProgress.Checked = World.Settings.ShowDownloadIndicator;
                this.c_miShowCrosshair.Checked = World.Settings.ShowCrosshairs;
                this.c_miShowInfoOverlay.Checked = World.Settings.ShowPosition;
                this.c_miShowGridlines.Checked = World.Settings.ShowLatLonLines;
                this.c_miShowGlobalClouds.Checked = World.Settings.ShowClouds;
                if (World.Settings.EnableSunShading)
                {
                    if (!World.Settings.SunSynchedWithTime)
                        this.c_miSunshadingEnabled.Checked = true;
                    else
                        this.c_miSunshadingSync.Checked = true;
                }
                else
                    this.c_miSunshadingDisabled.Checked = true;
                this.c_miShowAtmoScatter.Checked = World.Settings.EnableAtmosphericScattering;

                this.c_miAskLastViewAtStartup.Checked = Settings.AskLastViewAtStartup;
                if (!Settings.AskLastViewAtStartup)
                    this.c_miOpenLastViewAtStartup.Checked = Settings.LastViewAtStartup;

                #region OverviewPanel

                // Fix: earlier versions of Dapple set the DataPath as an absolute reference, so if Dapple was uninstalled, OMapple could not find
                // the file for the overview control.  To fix this, switch the variable to a relative reference if the absolute one doesn't resolve.
                // Dapple will still work; the relative reference will be from whatever directory Dapple is being run.
                if (!Directory.Exists(Settings.DataPath)) Settings.DataPath = "Data";

                #endregion

                c_oWorldWindow.MouseEnter += new EventHandler(this.c_oWorldWindow_MouseEnter);
                c_oWorldWindow.MouseLeave += new EventHandler(this.c_oWorldWindow_MouseLeave);
                c_oOverview.AOISelected += new Overview.AOISelectedDelegate(c_oOverview_AOISelected);

                #region Search view setup

                this.c_oServerList = new ServerList();
                m_oModel = new DappleModel(c_oLayerList);
                m_oModel.SelectedNodeChanged += new EventHandler(m_oModel_SelectedNodeChanged);
                c_oLayerList.Attach(m_oModel);
                NewServerTree.View.ServerTree newServerTree = new NewServerTree.View.ServerTree();
                newServerTree.Attach(m_oModel);
                c_oServerList.Attach(m_oModel);
                c_oLayerList.LayerSelectionChanged += new EventHandler(c_oLayerList_LayerSelectionChanged);

                m_oMetadataDisplay = new MetadataDisplayThread(this);
                m_oMetadataDisplay.AddBuilder(null);
                c_oServerList.LayerList = c_oLayerList;
                c_oLayerList.GoTo += new LayerList.GoToHandler(this.GoTo);

                c_oLayerList.ViewMetadata += new ViewMetadataHandler(m_oMetadataDisplay.AddBuilder);
                c_oServerList.ViewMetadata += new ViewMetadataHandler(m_oMetadataDisplay.AddBuilder);
                c_oServerList.LayerSelectionChanged += new EventHandler(c_oServerList_LayerSelectionChanged);

                this.cServerViewsTab = new JanaTab();
                this.cServerViewsTab.SetImage(0, Resources.tab_tree);
                this.cServerViewsTab.SetImage(1, Resources.tab_list);
                this.cServerViewsTab.SetToolTip(0, "Server tree view");
                this.cServerViewsTab.SetToolTip(1, "Server list view");
                this.cServerViewsTab.SetNameAndText(0, "TreeView");
                this.cServerViewsTab.SetNameAndText(1, "ListView");
                this.cServerViewsTab.SetPage(0, newServerTree);
                this.cServerViewsTab.SetPage(1, this.c_oServerList);
                cServerViewsTab.PageChanged += new JanaTab.PageChangedDelegate(ServerPageChanged);

                c_oDappleSearch = new DappleSearchList();
                c_oDappleSearch.LayerSelectionChanged += new EventHandler(c_oDappleSearch_LayerSelectionChanged);
                c_oDappleSearch.Attach(m_oModel, c_oLayerList);

                c_tcSearchViews.TabPages[0].Controls.Add(cServerViewsTab);
                cServerViewsTab.Dock = DockStyle.Fill;
                c_tcSearchViews.TabPages[1].Controls.Add(c_oDappleSearch);
                c_oDappleSearch.Dock = DockStyle.Fill;

                c_oLayerList.SetBaseLayer(new BlueMarbleBuilder());

                this.ResumeLayout(false);

                #endregion

                this.PerformLayout();

                while (!this.splashScreen.IsDone)
                    System.Threading.Thread.Sleep(50);

                // Force initial render to avoid showing random contents of frame buffer to user.
                c_oWorldWindow.Render();
                WorldWindow.Focus();

                #region OM Forked Process configuration

                if (IsRunningAsDapClient)
                {
                    c_oLayerList.OMFeaturesEnabled = true;
                    this.MinimizeBox = false;

                    if (oAoi != null && !string.IsNullOrEmpty(strAoiCoordinateSystem))
                    {
                        s_oOMMapExtentNative = oAoi;
                        s_strAoiCoordinateSystem = strAoiCoordinateSystem;
                        s_strOpenMapFileName = strMapFileName;

                        s_oOMMapExtentWGS84 = s_oOMMapExtentNative.Clone() as GeographicBoundingBox;
                        s_oMontajRemoteInterface.ProjectBoundingRectangle(strAoiCoordinateSystem, ref s_oOMMapExtentWGS84.West, ref s_oOMMapExtentWGS84.South, ref s_oOMMapExtentWGS84.East, ref s_oOMMapExtentWGS84.North, Dapple.Extract.Resolution.WGS_84);
                    }
                    s_eClientType = eClientType;

                    c_miLastView.Enabled = false;
                    c_miLastView.Visible = false;
                    c_miDappleHelp.Visible = false;
                    c_miDappleHelp.Enabled = false;
                    toolStripSeparator10.Visible = false;
                    c_miOpenImage.Visible = false;
                    c_miOpenImage.Enabled = false;
                    c_miOpenKeyhole.Visible = false;
                    c_miOpenKeyhole.Enabled = false;

                    // Hide and disable the file menu
                    c_miFile.Visible = false;
                    c_miFile.Enabled = false;
                    c_miOpenSavedView.Visible = false;
                    c_miOpenSavedView.Enabled = false;
                    c_miOpenHomeView.Visible = false;
                    c_miOpenHomeView.Enabled = false;
                    c_miSetHomeView.Visible = false;
                    c_miSetHomeView.Enabled = false;
                    c_miSaveView.Visible = false;
                    c_miSaveView.Enabled = false;
                    c_miSendViewTo.Visible = false;
                    c_miSendViewTo.Enabled = false;
                    c_miOpenKeyhole.Visible = false;
                    c_miOpenKeyhole.Enabled = false;

                    // Show the OM help menu
                    c_miGetDatahelp.Enabled = true;
                    c_miGetDatahelp.Visible = true;

                    // Don't let the user check for updates.  EVER.
                    c_miCheckForUpdates.Visible = false;
                    c_miCheckForUpdates.Enabled = false;
                }
                else
                {
                    c_miExtractLayers.Visible = false;
                    c_miExtractLayers.Enabled = false;
                }

                #endregion

                loadCountryList();
                populateAoiComboBox();
                LoadMRUList();
                CenterNavigationToolStrip();
                //#if !DEBUG

                c_tbSearchKeywords.Text = NO_SEARCH;
            }
            //#endif
        }
Пример #42
0
 /// <summary>
 /// ���oRMS��ܤ��e
 /// </summary>
 /// <param name="output">RMSOutputData</param>
 /// <returns></returns>
 public static string getRMSDisplay(RemoteInterface.HC.RMSOutputData output)
 {
     string display = getRmsModeString(output.mode);
     if (output.mode == 3)
         display += string.Format(",�ɨ{0}", output.planno);
     return display;
 }
Пример #43
0
 /// <summary>
 /// ���oRGS��ܤ��e
 /// </summary>
 /// <param name="output"></param>
 /// <param name="graph_code_id"></param>
 /// <param name="icon1"></param>
 /// <param name="icon2"></param>
 /// <param name="meg"></param>
 public static void getRGSDisplay(RemoteInterface.MFCC.RGS_GenericDisplay_Data output, ref byte graph_code_id, ref byte icon1, ref byte icon2, ref string meg)
 {
     for (int i = 0; i < output.icons.Length; i++)
     {
         if (i == 1)
             icon1 = output.icons[i].icon_code_id;
         else if (i == 2)
             icon2 = output.icons[i].icon_code_id;
     }
     foreach (RemoteInterface.MFCC.RGS_Generic_Message_Data message in output.msgs)
     {
         if (message == null) continue;
         meg += message.messgae + "\r";
     }
     graph_code_id = output.graph_code_id;
     meg = meg.Substring(0, meg.Length - 1 > 0 ? meg.Length - 1 : 0);
 }
Пример #44
0
 public static string getMASDisplay(RemoteInterface.HC.MASOutputData output)
 {
     StringBuilder sb = new StringBuilder();
     for(int i =0;i<output.displays.Length;i++)
     {
         if (output.displays[i] is int)
         {
             sb.AppendFormat("��{0}���D�t��:{1} ",i+1,output.displays[i]);
         }
         else if (output.displays[i] is RemoteInterface.HC.CMSOutputData)
         {
             RemoteInterface.HC.CMSOutputData cms = (RemoteInterface.HC.CMSOutputData)output.displays[i];
             sb.AppendFormat("��{0}���D�ϥ�:{1} ", i + 1, cms.g_code_id);
         }
     }
     return sb.ToString();
 }
Пример #45
0
 /// <summary>
 /// ���oLCS��ܤ��e
 /// </summary>
 /// <param name="output">LCSOutputData</param>
 /// <returns></returns>
 public static string getLCSDisplay(RemoteInterface.HC.LCSOutputData output)
 {
     string display = "";
     foreach (System.Data.DataRow row in output.dataset.Tables[1].Rows)
     {
         display += string.Format("{0}��ܤ��e:{1}   ", row["sign_no"].ToString() == "0" ? "�����D" : "�~���D", Byte2String(Convert.ToByte(row["sign_status"])));
     }
     return display;
 }
Пример #46
0
        protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
        {
            System.Collections.Hashtable displayht = new System.Collections.Hashtable();
            //if (devNames.Length == 0||Math.Abs(devNames[0].Mileage - int.Parse(ht["FROM_MILEPOST1"].ToString())) > getValidRangle()) return displayht;
            //List<object> outputs = new List<object>();
            if (devNames == null || devNames.Length == 0) return displayht;
            RemoteInterface.HC.I_HC_FWIS hobj = EasyClient.getHost();
            com.select(DBConnect.DataType.CSLS, Command.GetSelectCmd.getSectionSpeed(ht["ORIGINAL_INC_LOCATION"].ToString()));

            int ColNum;

            if (type == CategoryType.GEN)
            {
                switch (degree)
                {
                    case Degree.L:
                        ColNum = 1;
                        break;
                    case Degree.M:
                        ColNum = 2;
                        break;
                    case Degree.H:
                        ColNum = 3;
                        break;
                    case Degree.S:
                        ColNum = 4;
                        break;
                    default:
                        ColNum = 1;
                        break;
                }
            }
            else
            {
                ColNum = Convert.ToInt32(ht["INC_CONGESTION"]);
            }
            string cmd = string.Format("Select SuggesSpeeD{0} From {1}.{2} csls,{1}.{3} rule where AlarmClass = {4} and csls.RuleID = rule.RuleID and rule.RUNING = 'Y';"
                    , ColNum, RSPGlobal.GlobaSchema, DBConnect.DB2TableName.tblRSPCSLSSpeed, DBConnect.DB2TableName.tblRSPRule, ht["INC_NAME"]);
            System.Data.DataTable DT = com.Select(cmd);
            if (DT != null && DT.Rows.Count > 0)
            {
                maxSpeed = Convert.ToInt32(DT.Rows[0][0]);
                if (maxSpeed == -1)
                {
                    return displayht;
                }
            }
            cmd = string.Format("Select * from {0}.{1} csls,{0}.{2} rule where csls.RuleID = rule.ruleid and rule.runing = 'Y' and SuggesSpeed = {3};"
                , RSPGlobal.GlobaSchema, DBConnect.DB2TableName.tblIIPCSLSParam, DBConnect.DB2TableName.tblRSPRule, maxSpeed);

            DT = com.Select(cmd);
            if (DT.Rows.Count < 1)
            {
                throw new Exception("not Mapping CSLS Speed");
            }
            System.Data.DataRow dr = DT.Rows[0];
            List<int> SpeedList = new List<int>();
            SpeedList.Add(Convert.ToInt32(dr[UPStream1]));
            SpeedList.Add(Convert.ToInt32(dr[UPStream2]));
            SpeedList.Add(Convert.ToInt32(dr[UPStream3]));
            SpeedList.Add(Convert.ToInt32(dr[UPStream4]));
            SpeedList.Add(Convert.ToInt32(dr[UPStream5]));

            range = Convert.ToInt32(dr[RangerLimit]) * 1000;
            int i = 0;
            int SetSpped = 90;

            int SectionMaxSpeed = 90;
            if (devNames.Length > 0)
            {
                cmd = string.Format("Select sec.MaxSpeed From {0}.{1} sec, {0}.{2} cfg where sec.sectionid = cfg.sectionID and cfg.DeviceName = '{3}';"
                            , RSPGlobal.GlobaSchema, DBConnect.DB2TableName.tblGroupSection, DBConnect.DB2TableName.tblDeviceConfig, devNames[0].DevName);
                DT = com.Select(cmd);
                if (DT.Rows.Count > 0)
                {
                    SectionMaxSpeed = (int)DT.Rows[0][0];
                }
            }

            for (int j = 0; j < devNames.Length;j++ )
            {
                if (maxSegId != 99 && (int)ht["INC_NAME"] == 31 && ((devNames[j].Mileage > Convert.ToInt32(ht["FROM_MILEPOST1"])
                    && devNames[j].Mileage < Convert.ToInt32(ht["TO_MILEPOST1"])) ||(devNames[j].Mileage < Convert.ToInt32(ht["FROM_MILEPOST1"])
                    && devNames[j].Mileage > Convert.ToInt32(ht["TO_MILEPOST1"])) ))
                {
                    SetSpped = 255;//����
                }

                else if (devNames[j].Location == "D")//�U��
                {
                    cmd = string.Format("Select sec.MaxSpeed From {0}.{1} sec, {0}.{2} cfg where sec.sectionid = cfg.sectionID and cfg.DeviceName = '{3}';"
                        , RSPGlobal.GlobaSchema, DBConnect.DB2TableName.tblGroupSection, DBConnect.DB2TableName.tblDeviceConfig, devNames[j].DevName);
                    DT = com.Select(cmd);
                    if (DT.Rows.Count > 0)
                    {
                        SetSpped = (int)DT.Rows[0][0];
                    }
                }
                else
                {
                    if (maxSegId != -99
                        && ((j == 0 && (Math.Abs(devNames[j].Mileage - Convert.ToInt32(ht["FROM_MILEPOST1"])) > range
                            && Math.Abs(devNames[j].Mileage - Convert.ToInt32(ht["TO_MILEPOST1"])) > range))
                        || (j > 0 && devNames[j-1].Location != "D" && Math.Abs(devNames[j].Mileage - devNames[j - 1].Mileage) > range)))
                        break;

                    if (maxSegId == -99) //�d�� �̧C�t��
                    {
                        SetSpped = SpeedList[0];
                    }
                    else                //�d��~
                    {
                        if (i >= SpeedList.Count || SpeedList[i].Equals(-1))
                        {
                            break;
                        }
                        else
                        {
                            if (SectionMaxSpeed < SpeedList[i])
                                SetSpped = SectionMaxSpeed;
                            else
                                SetSpped = SpeedList[i];
                        }
                    }
                    i++;
                }

                System.Data.DataSet DS = hobj.getSendDs("CSLS", "set_speed");
                DS.Tables[0].Rows[0]["speed"] = SetSpped;
                DS.AcceptChanges();
                List<object> output = new List<object>();
                output.AddRange(new object[] { SetSpped / 10, new RemoteInterface.HC.CSLSOutputData(DS) });
                if (!displayht.Contains(devNames[j].DevName))
                {
                    displayht.Add(devNames[j].DevName, output);
                }

            }

            #region OLD Function
            //if (maxSegId == -99)
            //{
            //    foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            //    {
            //        System.Data.DataSet DS = hobj.getSendDs("CSLS", "set_speed");
            //        if (devName.minSpd > minSpeed)
            //            DS.Tables[0].Rows[0]["speed"] = devName.minSpd;  //�t��
            //        else
            //            DS.Tables[0].Rows[0]["speed"] = minSpeed;  //�t��
            //        DS.AcceptChanges();
            //        List<object> output = new List<object>();
            //        output.AddRange(new object[] { (int)(Convert.ToInt32(DS.Tables[0].Rows[0]["speed"]) / 10), new RemoteInterface.HC.CSLSOutputData(DS) });
            //        displayht.Add(devName.DevName, output);
            //    }
            //}
            //else
            //{
            //    int speed = minSpeed - decrease;
            //    foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            //    {
            //        System.Data.DataSet DS = hobj.getSendDs("CSLS", "set_speed");
            //        if (range == -1)
            //        {
            //            if (speed < maxSpeed) speed += decrease;
            //            if (devName.maxSpd >= speed)
            //                DS.Tables[0].Rows[0]["speed"] = speed;  //�t��
            //            else
            //                DS.Tables[0].Rows[0]["speed"] = devName.maxSpd;
            //        }
            //        else
            //        {
            //            if (devName.SegId < range)
            //            {
            //                if (devName.maxSpd >= speed)
            //                {
            //                    if (speed < maxSpeed) speed += decrease;
            //                    DS.Tables[0].Rows[0]["speed"] = speed;  //�t��
            //                }
            //                else
            //                    DS.Tables[0].Rows[0]["speed"] = devName.maxSpd;
            //            }
            //            else
            //            {
            //                if (devName.maxSpd >= speed)
            //                {
            //                    DS.Tables[0].Rows[0]["speed"] = maxSpeed;  //�t��
            //                }
            //                else
            //                    DS.Tables[0].Rows[0]["speed"] = devName.maxSpd;
            //            }
            //        }
            //        DS.AcceptChanges();
            //        List<object> output = new List<object>();
            //        output.AddRange(new object[] { (int)(Convert.ToInt32(DS.Tables[0].Rows[0]["speed"]) / 10), new RemoteInterface.HC.CSLSOutputData(DS) });
            //        displayht.Add(devName.DevName, output);
            //    }
            //}
            #endregion
            return displayht;
        }
Пример #47
0
        void nclient_OnEvent(object sender, RemoteInterface.NotifyEventObject objEvent)
        {
            // throw new Exception("The method or operation is not implemented.");
            try
            {
                if (objEvent.type == RemoteInterface.EventEnumType.MFCC_Comm_Moniter_Event)
                {
                    string comdata = System.Convert.ToString(objEvent.EventObj);
                    if (this.toolStripButton1.Text != "開始")
                        System.IO.File.AppendAllText(txtPathFile.Text, comdata+"\r\n");
                    databuff.Enqueue(comdata);
                    if (databuff.Count > 100)
                        databuff.Dequeue();

                    this.Invoke(new UpdateHandler(updatewindows));
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
Пример #48
0
 /// <summary>
 /// �]�w�Ҧ���ܤ��e
 /// </summary>
 /// <param name="devNames">�n��ܤ��]��</param>
 /// <param name="maxSegId">�̻���q���s�X</param>
 /// <param name="megType">���o�@��ƥ�T�����A</param>
 /// <returns>�]�ƹ�I���e</returns>
 protected virtual System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
 {
     return null;
 }
Пример #49
0
        void nclient_OnEvent(RemoteInterface.NotifyEventObject objEvent)
        {
            //throw new Exception("The method or operation is not implemented.");
            // MessageBox.Show("New Section Data");

            if (objEvent.type == RemoteInterface.EventEnumType.QY_New_Travel_Time_Data)
            {
                try
                {

                    this.Invoke(new invokeMethod(UpdateMethod), objEvent);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
                MessageBox.Show("未定義的事件資料");
        }
Пример #50
0
 void UpdateMethod(RemoteInterface.NotifyEventObject objEvent)
 {
     this.dataGridView1.DataSource = objEvent.EventObj;
     this.dataGridView1.DataMember = "tblRGS_Config";
     this.dataGridView1.Refresh();
     try
     {
         this.Text = Util.robj.get_current_travel_data_time_stamp().ToString();
     }
     catch (Exception ex)
     {
         ;
     }
 }
Пример #51
0
 public void setVDFiveMinData(string devName, RemoteInterface.MFCC.VD1MinCycleEventData data)
 {
     try
     {
         if (dictPerformance.ContainsKey("setVDFiveMinData"))
         {
             dictPerformance["setVDFiveMinData"].CallCount++;
             dictPerformance["setVDFiveMinData"].InCount++;
         }
         //((VDDeviceWrapper)Program.matrix.getDeviceWrapper(devName)).Set5MinAvgData(data);
         Program.matrix.vd5minavg_mgr.Set5MinAvgData(data);
     }
     catch (Exception ex)
     {
         throw new RemoteException(ex.Message);
     }
     finally
     {
         if (dictPerformance.ContainsKey("setVDFiveMinData"))
         {
           //  dictPerformance["setVDFiveMinData"].CallCount++;
             dictPerformance["setVDFiveMinData"].InCount--;
         }
     }
 }
Пример #52
0
 /// <summary>
 /// �]�w2x8���m���O��ܤ��e
 /// </summary>
 /// <returns>2x8���m���O��ܤ��e</returns>
 private RemoteInterface.HC.CMSOutputData get2x8Display(RemoteInterface.HC.CMSOutputData Mess, int isIcon)
 {
     if (isIcon == 0)
     {
         Mess = getDisplay(Mess, 2, 8);
     }
     else
     {
         if (isIcon == 1)
             Mess.icon_id = Convert.ToInt32(ht["LINE_ICON"]);
         else if (isIcon == 2)
             Mess.icon_id = Convert.ToInt32(ht["ACC_ICON"]);
         if (Mess.dataType == 4)
             Mess.dataType = 10;
         Mess = getDisplay(Mess, 2, 6);
     }
     return Mess;
 }
Пример #53
0
 private RemoteInterface.HC.CMSOutputData getDisplay(RemoteInterface.HC.CMSOutputData Mess, int row, int col)
 {
     BlockMegAndColor megColor = new BlockMegAndColor(Mess.mesg, Mess.colors);
     Mess.mesg = "";
     List<byte> cmsColorlist = new List<byte>();
     foreach (BlockMegAndColor meg in separateMegColor(devType, row, col, megColor))
     {
         if (meg == null) break;
         Mess.mesg += meg.Message + "\r";
         cmsColorlist.AddRange(meg.Color);
     }
     Mess.mesg = Mess.mesg.TrimEnd('\r');
     Mess.colors = cmsColorlist.ToArray();
     return Mess;
 }
Пример #54
0
        protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
        {
            if (tunnel == null) return null;
            com.select(DBConnect.DataType.Tunnel, Command.GetSelectCmd.getTunnelData(tunnel.Id, tunnel.Direction));

            System.Collections.Hashtable displayht = new System.Collections.Hashtable();

            List<object> outputs = new List<object>();
            if (devNames == null) return displayht;
            RemoteInterface.HC.I_HC_FWIS hobj = EasyClient.getHost();

            //����:0, ��:2, ��:1  ��:3 , ��:4
            //int laneCount = Convert.ToInt32(ht["LANE_COUNT"]);
            int laneCount = 2;
            byte[] laneNearMeg = getBlockageMessage(laneCount, ht["INC_BLOCKAGE"].ToString());  //���D�Ƽg����2���D
            byte[] laneMiddleMeg = new byte[laneCount];

            if (laneNearMeg[0] == (byte)LCSLight.down && laneNearMeg[1] == (byte)LCSLight.forbid)
            {
                laneMiddleMeg[0] = laneNearMeg[0];
                laneMiddleMeg[1] = (byte)LCSLight.leftDown;
            }
            else if (laneNearMeg[0] == 2 && laneNearMeg[1] == 1)
            {
                laneMiddleMeg[0] = (byte)LCSLight.rightDown;
                laneMiddleMeg[1] = laneNearMeg[1];
            }
            else
            {
                laneMiddleMeg = laneNearMeg;
            }

            for (int i = 0; i < laneCount; i++)
            {
                if (isReturnFlash)
                    laneMiddleMeg[i] += 4;
                if (isEventFlash)
                    laneNearMeg[i] += 4;
            }

            for(int i=0;i<devNames.Length;i++)
            {
                System.Data.DataSet DS = hobj.getSendDs("LCS", "set_ctl_sign");

                DS.Tables[0].Rows[0]["sign_cnt"] = Convert.ToByte(laneCount);

                byte CommInside = 0;
                byte CommOutside = 0;
                if (i < n_device)
                {
                    CommInside=laneMiddleMeg[0];
                    CommOutside = laneMiddleMeg[1];
                }
                else
                {
                    CommInside = laneNearMeg[0];
                    CommOutside = laneNearMeg[1];
                }
                //�����D
                System.Data.DataRow DShow = DS.Tables[1].NewRow();
                DShow["sign_no"] = Convert.ToByte(0);
                DShow["sign_status"] = CommInside;
                DS.Tables[1].Rows.Add(DShow);
                //�~���D
                DShow = DS.Tables[1].NewRow();
                DShow["sign_no"] = Convert.ToByte(1);
                DShow["sign_status"] = CommOutside;
                DS.Tables[1].Rows.Add(DShow);
                DS.AcceptChanges();

                List<object> output = new List<object>();
                output.AddRange(new object[] { getPriority(), new RemoteInterface.HC.LCSOutputData(DS) });
                displayht.Add(devNames[i].DevName, output);
            }
            return displayht;
        }
Пример #55
0
 public EntryPoint(RemoteHooking.IContext inContext, string inChannelName)
 {
     Interface = RemoteHooking.IpcConnectClient<RemoteInterface>(inChannelName);
 }
Пример #56
0
        void nClient_OnEvent(object sender, RemoteInterface.NotifyEventObject objEvent)
        {
            if(objEvent.EventObj is NotifyMessage)
            {
               NotifyMessage mesg= objEvent.EventObj as NotifyMessage;
               this.BeginInvoke(new InvokeDelegate(InvokeTask), mesg);

            }
            if (objEvent.type == EventEnumType.TEST)
            {
              System.Diagnostics.Debug.Print( DateTime.Now.ToShortDateString()+",test");
            }

              //  throw new NotImplementedException();
        }
Пример #57
0
 /// <summary>
 /// �]�w�@��ƥ���ܤ��e
 /// </summary>
 /// <param name="devNames">�n��ܤ��]��</param>
 /// <param name="maxSegId">�̻���q���s�X</param>
 /// <returns>�]�ƹ�I���e</returns>
 protected virtual System.Collections.Hashtable setGENDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId,string direction)
 {
     int unit_Start = findUnitSection(Convert.ToInt32(ht["FROM_MILEPOST1"]), direction);
     megType = getGeneralMsgType(degree, Convert.ToInt32(ht["INC_CONGESTION"]), unit_Start,direction);
     //this.serMeg.setServerMeg(string.Format("�ƥ�T�����A:{0}", megType.ToString()));
     return setDisplay(devNames, maxSegId, megType);
 }
Пример #58
0
        private void DoSetTravelMode_Job(RemoteInterface.HC.ScheduleTask.SetTravelModeTask job)
        {
            string sql = "";
              if (job.Enable)
              {
              sql = "update tblRGSTravelTime set enable='Y' where deviceName='" + this.devName + "'";
              Program.matrix.dbServer.SendCmdImmediately(sql);

              object dev = Program.matrix.getDevicemanager()[this.devName];
              if (dev is Host.TC.RGSDeviceWrapper)
                  (dev as Host.TC.RGSDeviceWrapper).loadTravelSetting();
              if (dev is Host.TC.CMSDeviceWrapper)
                  (dev as Host.TC.CMSDeviceWrapper).loadTravelSetting();
              }
              else
              {
              sql = "update tblRGSTravelTime set enable='N' where deviceName='" + this.devName + "'";
              object dev = Program.matrix.getDevicemanager()[this.devName];
              Program.matrix.dbServer.SendCmdImmediately(sql);
              if (dev is Host.TC.RGSDeviceWrapper)
                  (dev as Host.TC.RGSDeviceWrapper).removeOutput(OutputQueueData.TRAVEL_PRIORITY);
              if (dev is Host.TC.CMSDeviceWrapper)
                  (dev as Host.TC.CMSDeviceWrapper).removeOutput(OutputQueueData.TRAVEL_PRIORITY);
              }
        }
Пример #59
0
        protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
        {
            System.Collections.Hashtable displayht = new System.Collections.Hashtable();
            int mile_s = Convert.ToInt32(ht["FROM_MILEPOST1"]);
            int mile_e = Convert.ToInt32(ht["TO_MILEPOST1"]);
            if (devNames == null)
                return displayht;
            if (tunnel == null && devNames != null && devNames.Length>0)
            {
                tunnel = TunnelData.getBuilder().tunList.Find(new EventObj(devNames[0].LineId, devNames[0].Direction, devNames[0].Mileage));
            }

            if (tunnel == null && mile_s != mile_e)
            {
                for (int i = 1; i < devNames.Length; i++)
                {
                    tunnel = TunnelData.getBuilder().tunList.Find(new EventObj(devNames[i].LineId, devNames[i].Direction, devNames[i].Mileage));
                    if (tunnel != null)
                        break;
                }
            }

            if (tunnel == null) return displayht;

            com.select(DBConnect.DataType.Tunnel, Command.GetSelectCmd.getTunnelData(tunnel.Id, tunnel.Direction));

            List<object> outputs = new List<object>();
            if (devNames == null || devNames.Length == 0) return displayht;
            RemoteInterface.HC.I_HC_FWIS hobj = EasyClient.getHost();

            //string direction = Convert.ToString(ht["INC_DIRECTION"]).Trim();

            //����:0, ��:2, ��:1  ��:3 , ��:4
            //int laneCount = Convert.ToInt32(ht["LANE_COUNT"]);
            int laneCount = 2;
            byte[] laneNearMeg = getBlockageMessage(laneCount, ht["INC_BLOCKAGE"].ToString());  //���D�Ƽg����2���D
            byte[] laneMiddleMeg = new byte[laneCount];

            if (laneNearMeg[0] == (byte)LCSLight.down && laneNearMeg[1] == (byte)LCSLight.forbid)
            {
                laneMiddleMeg[0] = laneNearMeg[0];
                laneMiddleMeg[1] = (byte)LCSLight.leftDown;
            }
            else if (laneNearMeg[0] == 2 && laneNearMeg[1] == 1)
            {
                laneMiddleMeg[0] = (byte)LCSLight.rightDown;
                laneMiddleMeg[1] = laneNearMeg[1];
            }
            else
            {
                laneMiddleMeg = laneNearMeg;
            }

            for (int i = 0; i < laneCount; i++)
            {
                if (isReturnFlash)
                    laneMiddleMeg[i] += 4;
                else if (isEventFlash)
                    laneNearMeg[i] += 4;
            }

            bool UpOne = false;
            int segID =0;
            if (devNames.Length > 0)
                segID = devNames[devNames.Length -1].SegId;
            for (int i = devNames.Length-1; i >= 0; i--)
            {
                if (UpOne)
                    break;
                System.Data.DataSet DS = hobj.getSendDs("LCS", "set_ctl_sign");

                DS.Tables[0].Rows[0]["sign_cnt"] = Convert.ToByte(laneCount);

                byte CommInside = 0;
                byte CommOutside = 0;

                if (type == CategoryType.OBS)
                {
                    if (UpDown(tunnel.StartMileage, devNames[i].Mileage, devNames[i].Direction))
                    {
                        CommInside = laneNearMeg[0];
                        CommOutside = laneNearMeg[1];
                    }
                    else
                    {
                        CommInside = laneMiddleMeg[0];
                        CommOutside = laneMiddleMeg[1];
                        UpOne = true;
                    }
                }
                else
                {
                    if (laneNearMeg[0] % 4 == (byte)LCSLight.forbid && laneNearMeg[1] % 4 == (byte)LCSLight.forbid)
                    {
                        if (devNames[i].SegId != segID)
                            break;
                        if (UpDown(mile_s, devNames[i].Mileage,devNames[i].Direction))
                        {
                            //CommInside = (byte)LCSLight.down;
                            //CommOutside = (byte)LCSLight.down;
                            CommInside = laneNearMeg[0];
                            CommOutside = laneNearMeg[1];
                        }
                        else
                        {
                            CommInside = laneNearMeg[0];
                            CommOutside = laneNearMeg[1];
                        }
                    }
                    else
                    {
                        if (UpDown(mile_s, devNames[i].Mileage, devNames[i].Direction))
                        {
                            //CommInside = (byte)LCSLight.down;
                            //CommOutside = (byte)LCSLight.down;
                            CommInside = laneNearMeg[0];
                            CommOutside = laneNearMeg[1];
                        }
                        else if (UpDown(tunnel.StartMileage, devNames[i].Mileage, devNames[i].Direction))
                        {
                            //if (i == 0 || (tunnel.UpstreamLocation != null && UpDown(devNames[i - 1].Mileage, tunnel.UpstreamLocation.EndMileage, devNames[i -1].Direction)))
                            if (i == 0 || (!UpDown(tunnel.StartMileage,devNames[i-1].Mileage,devNames[i].Direction) && Math.Abs(tunnel.StartMileage - devNames[i -1].Mileage) > 200))
                            {
                                CommInside = laneMiddleMeg[0];
                                CommOutside = laneMiddleMeg[1];
                                UpOne = true;
                            }
                            else
                            {
                                CommInside = laneNearMeg[0];
                                CommOutside = laneNearMeg[1];
                            }
                        }
                        else
                        {
                            if (Math.Abs(tunnel.StartMileage - devNames[i].Mileage) < 200)
                            {
                                CommInside = laneMiddleMeg[0];
                                CommOutside = laneMiddleMeg[1];
                                UpOne = true;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }

                //�����D
                System.Data.DataRow DShow = DS.Tables[1].NewRow();
                DShow["sign_no"] = Convert.ToByte(0);
                DShow["sign_status"] = CommInside;
                DS.Tables[1].Rows.Add(DShow);
                //�~���D
                DShow = DS.Tables[1].NewRow();
                DShow["sign_no"] = Convert.ToByte(1);
                DShow["sign_status"] = CommOutside;
                DS.Tables[1].Rows.Add(DShow);
                DS.AcceptChanges();

                List<object> output = new List<object>();
                output.AddRange(new object[] { getPriority(), new RemoteInterface.HC.LCSOutputData(DS) });
                displayht.Add(devNames[i].DevName, output);
            }
            return displayht;
        }
Пример #60
0
 /// <summary>
 /// �]�w�ѭԨƥ���ܤ��e
 /// </summary>
 /// <param name="devNames">�n��ܤ��]��</param>
 /// <param name="maxSegId">�̻���q���s�X</param>
 /// <returns>�]�ƹ�I���e</returns>
 protected virtual System.Collections.Hashtable setWEADisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId)
 {
     megType = getNongeneralMsgType(degree, Convert.ToInt32(ht["INC_CONGESTION"]));
     //this.serMeg.setServerMeg(string.Format("�ƥ�T�����A:{0}", megType.ToString()));
     return setDisplay(devNames, maxSegId, megType);
 }