Exemplo n.º 1
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (ColumnLocal.ActualWidth > (this.ActualWidth - 15.0))
            {
                ColumnLocal.Width = new GridLength(this.ActualWidth - 15.0);
            }

            this.PreviewMouseUp += new MouseButtonEventHandler(window_PreviewMouseUp);
            this.Drop           += new DragEventHandler(window_Drop);
            this.Closing        += new CancelEventHandler(Window_Closing);
            this.GiveFeedback   += new GiveFeedbackEventHandler(window_GiveFeedback);

            ClientHelper.Owner           = this;
            ClientHelper.OnLock         += new ClientHelper.ClientHandler(Lock);
            ClientHelper.OnUnLock       += new ClientHelper.ClientHandler(UnLock);
            ClientHelper.OnConnecting   += new ClientHelper.StateHandler(Connecting);
            ClientHelper.OnConnected    += new ClientHelper.StateHandler(Connected);
            ClientHelper.OnDisconnected += new ClientHelper.StateHandler(Disconnected);

            ButtonServerConnect.Focus();

            SetPhrases();

            DragThumb.Set(this);

            await setLocalList(LocalHelper.Home);

            LocalHelper.OnListChanged += new LocalHelper.DirectoryHandler(localListChanged);
            TaskbarHelper.MainTaskbar  = MainTaskbar;

            AppMessage.Set(DetailList);
            DetailList.ItemsSource = AppMessage.Items;

            LabelServerTime.DataContext  = ClientHelper.Counts;
            LabelServerCount.DataContext = ClientHelper.Counts;

            ((INotifyPropertyChanged)(ServerList.View as GridView).Columns[0]).PropertyChanged += new PropertyChangedEventHandler(WidthPropertyChanged);
            hideServerToolbarAnimation.Completed += new EventHandler(hideServerToolbarAnimationCompleted);
            ServerItemsToolbarAnimation.Freeze();
            hideServerToolbarAnimation.Freeze();

            DragSelection.Register(this, LocalList, 0.0, 0.0, "ListBoxItem");
            DragSelection.Register(this, ServerList, 0.0, 20.0, "ListViewItem");

            DragWatcher.Source    = "PlusFTP.DragItems";
            DragWatcher.OnDraged += new DragWatcher.DragWatcherHandler(DragWatcher_Draged);

            AppLanguage.OnUpdated += new AppLanguage.UpdatedHandler(LanguageUpdated);

            CryptoHashing.Password = "******";

            VersionHelper.AppUrlHomePage = "http://PlusFTP.com/";
            VersionHelper.VersionUrl     = "http://PlusFTP.com/v";
            VersionHelper.NewAppUrl      = "http://PlusFTP.com/download/";
            if (AppSettings.Get("App", "CheckVersion", true) && (bool)await VersionHelper.Check())
            {
                NewVersionWindow.Initialize(this);
            }
        }