Ejemplo n.º 1
0
        private void receiveOutput(string data, ref int sz, ref int informType)
        {
            string   handle = null;
            string   msg    = null;
            TextType type   = TextType.Error;

            if (_session == null)
            {
                if (_allJoyn == null)
                {
                    _allJoyn = _connectForm.AJBus;
                }
                _session = new AllJoynSession(_allJoyn);
                if (!_connectForm.IsNameOwner)
                {
                    sendIdentityMessage();
                }
            }
            switch (informType)
            {
            case 0:
                type = TextType.Error;
                _buffer.AddDeferred(data, "Error", type);
                _transcriptText.AppendLine(data);
                break;

            case 1:
                type = TextType.Remote;
                if (parseForIdentity(data))
                {
                    return;
                }
                msg  = lookupChatter(data, out handle);
                data = msg;
                _buffer.AddDeferred(data, handle, type);
                _deferredStatus = "last message received " + dateTimeString();
                break;

            case 2:
                type = TextType.Status;
                _transcriptText.AppendLine(data);
                break;

            case 3:
                type = TextType.System;
                _transcriptText.AppendLine(data);
                break;

            default:
                type = TextType.Error;
                _buffer.AddDeferred(data, "Error", type);
                _transcriptText.AppendLine(data);
                break;
            }
        }
Ejemplo n.º 2
0
        public PhotoChatForm()
        {
            InitializeComponent();
            _allJoyn        = new AllJoynBus();
            _connectForm    = new AllJoynConnectForm(_allJoyn, this);
            _transcriptForm = new SimpleTranscript();
            _buffer         = new RichTextBuffer(richTextOutput);
            _chatText       = new StringBuilder(DateTime.Now.ToString());
            _chatText.AppendLine();
            _transcriptText = new StringBuilder("New Session " + DateTime.Now.ToString());
            _transcriptText.AppendLine(); // EOL

            _connected = false;

            // refresh of the UI and other events related to the UI are managed by this timer
            // see timedEvent() for details
            _timer          = new System.Windows.Forms.Timer();
            _timer.Interval = 300;
            _timer.Start();
            _timer.Tick   += new EventHandler(timedEvent);
            _timer.Enabled = true;

            // large thumbnails
            imageList1.ImageSize        = new Size(64, 64);
            imageList1.TransparentColor = Color.White;

            // small thumbnails
            _largeList                  = new ImageList();
            _largeList.ImageSize        = new Size(32, 32);
            _largeList.TransparentColor = Color.White;

            lvPic.LargeImageList = _largeList;
            lvPic.SmallImageList = _largeList;
            lvPic.View           = View.Tile;

            richTextOutput.AllowDrop  = true;
            richTextOutput.DragEnter += richTextOutput_DragEnter;
            richTextOutput.DragDrop  += richTextOutput_DragDrop;
        }