示例#1
0
 public string OpenImage(string ImageName, string LoadAs, bool AutoRotate, bool CloseAll)
 {
     if (Session[IGPEMultiplexing.SESSIONMEMBER_DISCONNECTED] != null)
         return IGPEWebServer.WEBSERVICE_RESULT_DISCONNECTED;
     string sUser = (string)Session[DatabaseUserSecurityAuthority.IGMADAM_USERNAME];
     if (CloseAll)
         IGPEWebServer.ProcessUserCommand(Session, new IGRequestFrameClose(sUser, "-1"));
     IGRequest req = new IGRequestWorkspaceLoad(sUser, ImageName, LoadAs.ToString(), AutoRotate ? "1" : "0");
     return IGPEWebServer.ProcessUserCommand(Session, req);
 }
示例#2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            try
            {
                IGRequest reqAdd = null;
                if (comboRequests.Text.StartsWith("WORKSPACE"))
                {
                    switch (comboRequests.SelectedIndex + 1000)
                    {
                        case IGRequest.IGREQUEST_WORKSPACE_CONNECT:
                            reqAdd = new IGRequestWorkspaceConnect(textBoxUser.Text);
                            break;
                        case IGRequest.IGREQUEST_WORKSPACE_PING:
                            reqAdd = new IGRequestWorkspacePing(textBoxUser.Text);
                            break;
                        case IGRequest.IGREQUEST_WORKSPACE_DISCONNECT:
                            reqAdd = new IGRequestWorkspaceDisconnect(textBoxUser.Text);
                            break;
                        case IGRequest.IGREQUEST_WORKSPACE_NEWIMAGE:
                            reqAdd = new IGRequestWorkspaceNew(textBoxUser.Text, textParam1.Text, textParam2.Text, textParam3.Text, textParam4.Text);
                            break;
                        case IGRequest.IGREQUEST_WORKSPACE_LOADIMAGE:
                            reqAdd = new IGRequestWorkspaceLoad(textBoxUser.Text, textParam1.Text, (textParam2.Text != "" && textParam2.Text != "0") ? textParam2.Text : "", (textParam3.Text != "" && textParam3.Text != "0") ? textParam3.Text : "");
                            break;
                        case IGRequest.IGREQUEST_WORKSPACE_SHOW:
                            reqAdd = new IGRequestWorkspaceShow(textBoxUser.Text, int.Parse(textParam1.Text) == 1);
                            break;
                    }
                }
                if (comboRequests.Text.StartsWith("FRAME"))
                {
                    switch (comboRequests.SelectedIndex - m_nNbWorkspaceReqs + 2000)
                    {
                        case IGRequest.IGREQUEST_FRAME_SAVE:
                            reqAdd = new IGRequestFrameSave(textBoxUser.Text, textParam1.Text, textParam2.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_ADDLAYER:
                            reqAdd = new IGRequestFrameAddLayer(textBoxUser.Text, textParam1.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_REMOVELAYER:
                            reqAdd = new IGRequestFrameRemoveLayer(textBoxUser.Text, textParam1.Text, textParam2.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_MOVELAYER:
                            reqAdd = new IGRequestFrameMoveLayer(textBoxUser.Text, textParam1.Text, textParam2.Text, textParam3.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_MERGELAYER:
                            reqAdd = new IGRequestFrameMergeLayer(textBoxUser.Text, textParam1.Text, textParam2.Text, textParam3.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_FILTER:
                            Dictionary<string, string> dicParams = null;
                            if (textParam4.Text.Contains('_'))
                            {
                                dicParams = textParam4.Text.Split(',').ToDictionary(str => str.Split('_')[0], str => str.Split('_')[1]);
                                if (dicParams.ContainsKey("PosX"))
                                    dicParams["PosX"] = fromPctToIGCoords(dicParams["PosX"]);
                                if (dicParams.ContainsKey("PosY"))
                                    dicParams["PosY"] = fromPctToIGCoords(dicParams["PosY"]);
                                if (dicParams.ContainsKey("DirectionX"))
                                    dicParams["DirectionX"] = fromPctToIGCoords(dicParams["DirectionX"]);
                                if (dicParams.ContainsKey("DirectionY"))
                                    dicParams["DirectionY"] = fromPctToIGCoords(dicParams["DirectionY"]);
                            }
                            reqAdd = new IGRequestFrameFilterLayer(textBoxUser.Text, textParam1.Text, textParam2.Text, textParam3.Text, dicParams);
                            break;
                        case IGRequest.IGREQUEST_FRAME_CHANGEPROPERTY:
                            reqAdd = new IGRequestChangeProperty(textBoxUser.Text, textParam1.Text, textParam2.Text, textParam3.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_CLOSE:
                            reqAdd = new IGRequestFrameClose(textBoxUser.Text, textParam1.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_UPDATE:
                            reqAdd = new IGRequestFrameUpdate(textBoxUser.Text, textParam1.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_SELECT:
                            reqAdd = new IGRequestFrameSelect(textBoxUser.Text, textParam1.Text, textParam2.Text, textParam3.Text, fromPctToIGCoords(textParam4.Text, false));
                            break;
                        case IGRequest.IGREQUEST_FRAME_SETLAYERVISIBLE:
                            reqAdd = new IGRequestFrameSetLayerVisible(textBoxUser.Text, textParam1.Text, textParam2.Text, textParam3.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_GOTOHISTORY:
                            reqAdd = new IGRequestFrameGotoHistory(textBoxUser.Text, textParam1.Text, textParam2.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_DRAWLINES:
                            reqAdd = new IGRequestFrameDrawLines(textBoxUser.Text, textParam1.Text, textParam2.Text, fromPctToIGCoords(textParam3.Text), textParam4.Text, "10");
                            break;
                        case IGRequest.IGREQUEST_FRAME_PICKCOLOR:
                            reqAdd = new IGRequestFramePickColor(textBoxUser.Text, textParam1.Text, textParam2.Text, fromPctToIGCoords(textParam3.Text));
                            break;
                        case IGRequest.IGREQUEST_FRAME_INDEX:
                            Regex RE = new Regex(@"[,]+");
                            string[] tParams2 = RE.Split(textParam2.Text);
                            if (tParams2.Length == 2)
                                reqAdd = new IGRequestFrameIndexLayer(textBoxUser.Text, textParam1.Text, tParams2[0], tParams2[1]);
                            else
                                reqAdd = new IGRequestFrameIndexLayer(textBoxUser.Text, textParam1.Text, tParams2[0], tParams2[1], tParams2[2], tParams2[3],
                                                                        fromPctToIGCoords(textParam3.Text), fromPctToIGCoords(textParam4.Text));
                            break;
                        case IGRequest.IGREQUEST_FRAME_COPY:
                            reqAdd = new IGRequestFrameCopy(textBoxUser.Text, textParam1.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_CUT:
                            reqAdd = new IGRequestFrameCut(textBoxUser.Text, textParam1.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_PASTE:
                            reqAdd = new IGRequestFramePaste(textBoxUser.Text, textParam1.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_DELETE:
                            reqAdd = new IGRequestFrameDelete(textBoxUser.Text, textParam1.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_SMARTDELETE:
                            reqAdd = new IGRequestFrameSmartDelete(textBoxUser.Text, textParam1.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_MOVE:
                            reqAdd = new IGRequestFrameMove(textBoxUser.Text, textParam1.Text, textParam2.Text, fromPctToIGCoords(textParam3.Text), fromPctToIGCoords(textParam4.Text));
                            break;
                        case IGRequest.IGREQUEST_FRAME_ROTATEANDRESIZE:
                            reqAdd = new IGRequestFrameRotateAndResize(textBoxUser.Text, textParam1.Text, textParam2.Text, textParam3.Text, fromPctToIGCoords(textParam4.Text));
                            break;
                        case IGRequest.IGREQUEST_FRAME_SELECTLAYER:
                            reqAdd = new IGRequestFrameSelectLayer(textBoxUser.Text, textParam1.Text, textParam2.Text);
                            break;
                        case IGRequest.IGREQUEST_FRAME_RUBBER:
                            reqAdd = new IGRequestFrameRubber(textBoxUser.Text, textParam1.Text, textParam2.Text, fromPctToIGCoords(textParam3.Text), textParam4.Text, "10");
                            break;
                    }
                }
                if (comboRequests.Text.StartsWith("SERVER"))
                {
                    switch ((IGSMRequest.IGSMREQUEST_ID)(comboRequests.SelectedIndex - m_nNbWorkspaceReqs - m_nNbFrameReqs + 5000))
                    {
                        case IGSMRequest.IGSMREQUEST_ID.IGSMREQUEST_PING:
                            reqAdd = new IGSMRequestPing();
                            break;
                        case IGSMRequest.IGSMREQUEST_ID.IGSMREQUEST_GETSTATUS:
                            reqAdd = new IGSMRequestGetStatus((IGSMStatus.IGSMStatusType)int.Parse(textParam1.Text));
                            break;
                        case IGSMRequest.IGSMREQUEST_ID.IGSMREQUEST_TERMINATE:
                            reqAdd = new IGSMRequestTerminate(int.Parse(textParam1.Text) == 1);
                            break;
                        case IGSMRequest.IGSMREQUEST_ID.IGSMREQUEST_DESTROYACCOUNT:
                            reqAdd = new IGSMRequestDestroyAccount(textBoxUser.Text);
                            break;

                    }
                }
                if (reqAdd == null)
                {
                    MessageBox.Show("Request " + comboRequests.SelectedText + " is not implemented");
                    return;
                }
                reqAdd.SetDisplay(reqAdd.GetDisplay().Replace('\n', ' '));
                listRequestBuffer.Items.Add(reqAdd);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString(), "Wrong request format");
            }
        }