示例#1
0
        private void RemotePaste_Execute(Object sender, ExecutedRoutedEventArgs e)
        {
            ServerTileUserControl tile = serverTiles[selectedIndex];

            tile.StartProgress();
            connection.RemotePaste();
        }
示例#2
0
        void connection_ServerTransferCancelled(object sender, ServerTranferEventArgs e)
        {
            if (e.Position < 0 || e.Position >= serverTiles.Count)
            {
                Trace.TraceWarning("Posizione è fuori range. Pisition:{0} Length:{1}. In connection_ServerTransferCancelled() ", e.Position, serverTiles.Count);
                return;
            }
            ServerTileUserControl tile = serverTiles[e.Position];

            tile.CancelProgress();
        }
示例#3
0
        void connection_ServerError(object sender, args.ServerErrorEventsArgs e)
        {
            switch (e.ErrorCode)
            {
            case ServerErrorEventsArgs.SERVER_ERROR:
            case ServerErrorEventsArgs.KEEP_ALIVE_NOT_RECEIVED:

                if (e.Position < 0 || e.Position >= serverTiles.Count)
                {
                    Trace.TraceError("Posizione è fuori range. Pisition:{0} Length:{1}. In connection_ServerError()", e.Position, serverTiles.Count);
                }
                else
                {
                    //rimuovo dalla lista dei server
                    servers.RemoveAt(e.Position);
                    //rimuovo la tile
                    ServerTileUserControl tile1 = serverTiles[e.Position];
                    stackPanel.Children.Remove(tile1);
                    serverTiles.RemoveAt(e.Position);
                }
                ErrorMessage("Problema con la rete del Server " + e.Server.Name);
                if (servers.Count == 0)
                {
                    this.Close();
                }
                break;

            case ServerErrorEventsArgs.NETWORK_ERROR:
                ErrorMessage("Connessione assente!");
                //rimuovo dalla lista dei server
                servers.Clear();
                this.Close();
                break;

            case ServerErrorEventsArgs.CLIPBOARD_IN_ACTION:
                ErrorMessage("Impossibile effettuare lo switch durante il trasferimento!");
                break;

            default:
                ErrorMessage("Si è verificato un errore inatteso");
                this.Close();
                break;
            }
        }
示例#4
0
        private void LoadServerTiles(ObservableCollection <Server> servers)
        {
            int            index = 0;
            BrushConverter bc    = new BrushConverter();

            foreach (var server in servers)
            {
                var serverTile = new ServerTileUserControl(server.Name, index + 1, (Brush)bc.ConvertFromString(colors[index]));
                serverTile.Width  = 150;
                serverTile.Height = 150;
                serverTile.Margin = new Thickness(7);
                string effect = (index == 0) ? "z-depth4" : "z-depth1";
                serverTile.Effect              = (System.Windows.Media.Effects.Effect) this.Resources[effect];
                serverTile.cancelButton.Click += cancelButton_Click;
                serverTiles.Add(serverTile);
                stackPanel.Children.Add(serverTile);
                index++;
            }
        }
示例#5
0
        void connection_ServerDisconnected(object sender, args.ServerEventArgs e)
        {
            if (e.Position < 0 || e.Position >= serverTiles.Count)
            {
                Trace.TraceError("Posizione è fuori range. Pisition:{0} Length:{1}. In connection_ServerActivated() ", e.Position, serverTiles.Count);
                return;
            }
            //rimuovo dalla lista dei server
            servers.RemoveAt(e.Position);
            //rimuovo la tile
            ServerTileUserControl tile = serverTiles[e.Position];

            stackPanel.Children.Remove(tile);
            serverTiles.RemoveAt(e.Position);

            if (servers.Count == 0)
            {
                this.Close();
            }
        }