Exemplo n.º 1
0
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            NetworkStream serverStream = clientSocket.GetStream();

            byte[] outStream = System.Text.Encoding.ASCII.GetBytes(ClientTextBox.Text + "$");
            serverStream.Write(outStream, 0, outStream.Length);
            serverStream.Flush();

            byte[] inStream = new byte[buffersize];
            serverStream.Read(inStream, 0, (int)clientSocket.ReceiveBufferSize);
            string returndata = System.Text.Encoding.ASCII.GetString(inStream);

            returndata = returndata.Substring(0, returndata.IndexOf('\0'));
            servermsg(returndata);
            ClientTextBox.Text = "";
            ClientTextBox.Focus();
        }
Exemplo n.º 2
0
        private void InitializeControlBindings()
        {
            UserIdTextBox.DataBindings.Clear();
            ProviderTextBox.DataBindings.Clear();
            ClientTextBox.DataBindings.Clear();
            InstituteIdTextBox.DataBindings.Clear();
            InstituteIdTypeComboBox.DataBindings.Clear();

            if (_headerIdentity == null)
            {
                return;
            }

            UserIdTextBox.SetTextDataBinding(_headerIdentity, nameof(_headerIdentity.UserId));
            ProviderTextBox.SetTextDataBinding(_headerIdentity, nameof(_headerIdentity.Provider));
            ClientTextBox.SetTextDataBinding(_headerIdentity, nameof(_headerIdentity.Client));
            InstituteIdTextBox.SetTextDataBinding(_headerIdentity, nameof(_headerIdentity.InstituteId));
            InstituteIdTypeComboBox.SetTextDataBinding(_headerIdentity, nameof(_headerIdentity.InstituteIdType));
        }
Exemplo n.º 3
0
        /**
         * Writes out the additional comment records
         *
         * @param outputFile the output file
         * @exception IOException
         */
        public virtual void writeAdditionalRecords(File outputFile)
        {
            if (origin == Origin.READ)
                {
                outputFile.write(objRecord);

                if (mso != null)
                    outputFile.write(mso);
                outputFile.write(txo);
                outputFile.write(text);
                if (formatting != null)
                    outputFile.write(formatting);
                return;
                }

            // Create the obj record
            ObjRecord objrec = new ObjRecord(objectId,ObjRecord.EXCELNOTE);

            outputFile.write(objrec);

            // Create the mso data record.  Write the text box record again,
            // although it is already included in the SpContainer
            ClientTextBox textBox = new ClientTextBox();
            MsoDrawingRecord msod = new MsoDrawingRecord(textBox.getData());
            outputFile.write(msod);

            TextobjectRecord txorec = new TextobjectRecord(getText());
            outputFile.write(txorec);

            // Data for the first continue record
            byte[] textData = new byte[commentText.Length * 2 + 1];
            textData[0] = 0x1; // unicode indicator
            StringHelper.getUnicodeBytes(commentText,textData,1);
            //StringHelper.getBytes(commentText, textData, 1);
            ContinueRecord textContinue = new ContinueRecord(textData);
            outputFile.write(textContinue);

            // Data for the formatting runs

            byte[] frData = new byte[16];

            // First txo run (the user)
            IntegerHelper.getTwoBytes(0,frData,0); // index to the first character
            IntegerHelper.getTwoBytes(0,frData,2); // index to the font(default)
            // Mandatory last txo run
            IntegerHelper.getTwoBytes(commentText.Length,frData,8);
            IntegerHelper.getTwoBytes(0,frData,10); // index to the font(default)

            ContinueRecord frContinue = new ContinueRecord(frData);
            outputFile.write(frContinue);
        }
Exemplo n.º 4
0
        /**
         * Creates the main Sp container for the drawing
         *
         * @return the SP container
         */
        public EscherContainer getSpContainer()
        {
            if (!initialized)
                {
                initialize();
                }

            if (origin == Origin.READ)
                {
                return getReadSpContainer();
                }

            if (spContainer == null)
                {
                spContainer = new SpContainer();
                Sp sp = new Sp(type,shapeId,2560);
                spContainer.add(sp);
                Opt opt = new Opt();
                opt.addProperty(344,false,false,0); // ?
                opt.addProperty(385,false,false,134217808); // fill colour
                opt.addProperty(387,false,false,134217808); // background colour
                opt.addProperty(959,false,false,131074); // hide
                spContainer.add(opt);

                ClientAnchor clientAnchor = new ClientAnchor(column + 1.3,
                                                             System.Math.Max(0,row - 0.6),
                                                             column + 1.3 + width,
                                                             row + height,
                                                             0x1);

                spContainer.add(clientAnchor);

                ClientData clientData = new ClientData();
                spContainer.add(clientData);

                ClientTextBox clientTextBox = new ClientTextBox();
                spContainer.add(clientTextBox);
                }

            return spContainer;
        }
        /**
         * Initialization
         */
        private void initialize()
        {
            int curpos = getPos() + HEADER_LENGTH;
            int endpos = System.Math.Min(getPos() + getLength(),getStreamLength());

            EscherRecord newRecord = null;

            while (curpos < endpos)
                {
                EscherRecordData erd = new EscherRecordData(getEscherStream(),curpos);

                EscherRecordType type = erd.getType();
                if (type == EscherRecordType.DGG)
                    newRecord = new Dgg(erd);
                else if (type == EscherRecordType.DG)
                    newRecord = new Dg(erd);
                else if (type == EscherRecordType.BSTORE_CONTAINER)
                    newRecord = new BStoreContainer(erd);
                else if (type == EscherRecordType.SPGR_CONTAINER)
                    newRecord = new SpgrContainer(erd);
                else if (type == EscherRecordType.SP_CONTAINER)
                    newRecord = new SpContainer(erd);
                else if (type == EscherRecordType.SPGR)
                    newRecord = new Spgr(erd);
                else if (type == EscherRecordType.SP)
                    newRecord = new Sp(erd);
                else if (type == EscherRecordType.CLIENT_ANCHOR)
                    newRecord = new ClientAnchor(erd);
                else if (type == EscherRecordType.CLIENT_DATA)
                    newRecord = new ClientData(erd);
                else if (type == EscherRecordType.BSE)
                    newRecord = new BlipStoreEntry(erd);
                else if (type == EscherRecordType.OPT)
                    newRecord = new Opt(erd);
                else if (type == EscherRecordType.SPLIT_MENU_COLORS)
                    newRecord = new SplitMenuColors(erd);
                else if (type == EscherRecordType.CLIENT_TEXT_BOX)
                    newRecord = new ClientTextBox(erd);
                else
                    newRecord = new EscherAtom(erd);

                children.Add(newRecord);
                curpos += newRecord.getLength();
                }

            initialized = true;
        }