Beispiel #1
0
        public void notify(Packet packet)
        {
            try {
                if (packet.Type.Equals("result"))
                {
                    voidDel vd = new voidDel(jaberModel.gui.Registered);
                    jaberModel.gui.Invoke(vd);
                }
                else
                {
                    String message = null;
                    if (packet.Type.Equals("error"))
                    {
                        Packet err = packet.getFirstChild("error");
                        message = err["code"] + " : " + err.getValue();

                        RegisterFailedDelegate rfd = new RegisterFailedDelegate(jaberModel.gui.RegistrationFailed);
                        jaberModel.gui.Invoke(rfd, new Object[] { message });
                    }
                    Console.WriteLine(message);
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            this._dal = new ChatDBmanager();

            chatUpdateTimer.Interval = 2000;
            chatUpdateTimer.Tick += chatUpdateTimer_Tick;

            this.tcb = TimerCllb;
            this.updDel = ChatUpdate;
        }
Beispiel #3
0
 // A worker is used to connect in a background thread
 private void connectBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     try {
         model.connect();
         model.authenticate();
     } catch (Exception ex) {
         Console.WriteLine("Exception while connecting" + ex.StackTrace);
         // Can not call directly (cross threading), use delegate
         voidDel vd = new voidDel(this.stopConnectingGUI);
         this.Invoke(vd);
         vd = new voidDel(this.showUnableToConnect);
         this.Invoke(vd);
     }
 }
		public void notify(Packet packet) {
			try {
				if(packet.Type.Equals("result")) {
					voidDel vd = new voidDel(jaberModel.gui.Registered);
					jaberModel.gui.Invoke(vd);
				} else {
					String message = null;
					if(packet.Type.Equals("error")) {
						Packet err = packet.getFirstChild("error");
						message = err["code"] + " : " + err.getValue();

						RegisterFailedDelegate rfd = new RegisterFailedDelegate(jaberModel.gui.RegistrationFailed);
						jaberModel.gui.Invoke(rfd, new Object[] {message});
					}
					Console.WriteLine(message);
				}
			} catch(Exception ex) {
				Console.WriteLine(ex.ToString());
			}
		}
Beispiel #5
0
        // Register in a background thread
        private void registerBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try {
                // Initialize model
                model.ServerName    = Properties.Settings.Default.ServerName;
                model.ServerAddress = Properties.Settings.Default.ServerAddress;
                model.Port          = Properties.Settings.Default.Port;
                model.User          = Properties.Settings.Default.Username;
                model.AuthMode      = Properties.Settings.Default.AuthMode;             //Додадено од Милош/Васко
                model.Resource      = Properties.Settings.Default.Resource;
                model.Password      = Properties.Settings.Default.Password;
                model.Me            = new Contact(model.User + "@" + model.ServerName);
                model.Me.Status     = Status.chat;

                model.connect();
                model.register();
            } catch (Exception ex) {
                Console.WriteLine("Exception while connecting: " + ex.ToString() + "\n" + ex.StackTrace);
                voidDel vd = new voidDel(this.stopConnectingGUI);
                this.Invoke(vd);
                vd = new voidDel(this.showUnableToConnect);
                this.Invoke(vd);
            }
        }
Beispiel #6
0
 public void SetJumps(voidDel forward, voidDel back, voidDel neutral)
 {
     jumpForward = forward;
     jumpBack    = back;
     jumpNeutral = neutral;
 }
		// Register in a background thread
		private void registerBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) {
			try {				
				// Initialize model
				model.ServerName = Properties.Settings.Default.ServerName;
				model.ServerAddress = Properties.Settings.Default.ServerAddress;
				model.Port = Properties.Settings.Default.Port;
				model.User = Properties.Settings.Default.Username;
				model.AuthMode = Properties.Settings.Default.AuthMode;	//Додадено од Милош/Васко
				model.Resource = Properties.Settings.Default.Resource;
				model.Password = Properties.Settings.Default.Password;
				model.Me = new Contact(model.User + "@" + model.ServerName);
				model.Me.Status = Status.chat;

				model.connect();
				model.register();
			} catch(Exception ex) {
				Console.WriteLine("Exception while connecting: " + ex.ToString() + "\n" + ex.StackTrace);
				voidDel vd = new voidDel(this.stopConnectingGUI);
				this.Invoke(vd);
				vd = new voidDel(this.showUnableToConnect);
				this.Invoke(vd);
			}
		}
		// A worker is used to connect in a background thread 
		private void connectBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) {
			try {
				model.connect();
				model.authenticate();
			} catch (Exception ex) {
				Console.WriteLine("Exception while connecting" + ex.StackTrace);
				// Can not call directly (cross threading), use delegate
				voidDel vd = new voidDel(this.stopConnectingGUI);
				this.Invoke(vd);
				vd = new voidDel(this.showUnableToConnect);
				this.Invoke(vd);				
			}
		}
Beispiel #9
0
 // Update is called once per frame
 void Update()
 {
     this._lastPos = Input.mousePosition;
     this._actionDel = this.noOp;
     if (this.actionEnabled)
     {
         if (Input.GetMouseButtonDown(0) && GUIUtility.hotControl == 0)
         {
             this._lastClick = Input.mousePosition;
             this._actionDel = this.singleSelection;
         }
         if (Input.GetMouseButton(0) && GUIUtility.hotControl == 0)
         {
             if (Vector2.Distance(this._lastClick, Input.mousePosition) > 10)
             {
                 this._actionDel = this.multipleSelection;
             }
         }
         if(Input.GetMouseButtonUp(0) && GUIUtility.hotControl == 0){
                 this.hideSelectionBox();
         }
         if (Input.GetMouseButtonDown(1) && GUIUtility.hotControl == 0)
         {
             this._lastClick = Input.mousePosition;
             this._actionDel = this.move;
         }
     }
     this._actionDel();
 }
Beispiel #10
0
 // Use this for initialization
 void Start()
 {
     this._manager = GetComponent<Manager>();
     this._actionDel = this.noOp;
     this._displayDel = this.noOp;
     //Physics.IgnoreLayerCollision(9, 9);
 }