Interaction logic for PatchProgress.xaml
Inheritance: System.Windows.Controls.UserControl
        void theControl_Checked(object sender, RoutedEventArgs e)
        {
            ServerInfo theServerInfo = null;

            brdServerInfo.Visibility = Visibility.Visible;
            ServerSelector theServer = sender as ServerSelector;

            if (theServer == null)
            {
                RadioButton rbIWasSelected = sender as RadioButton;
                theServerInfo = rbIWasSelected.DataContext as ServerInfo;
            }
            else
            {
                theServerInfo = theServer.TheServerInfo;
            }

            grdPatcher.Children.Clear();
            PatchProgress myPatchProgress = new PatchProgress(theServerInfo, myUserPrefs);

            myPatchProgress.DataContext    = this.DataContext;
            myPatchProgress.Loaded        += new RoutedEventHandler(myPatchProgress_Loaded);
            myPatchProgress.OnError       += new EventHandler <ErrorMessageEventArgs>(myPatchProgress_OnError);
            myPatchProgress.PatchComplete += new EventHandler <Patcher.PatchFunctionCompleteEventArgs>(myPatchProgress_PatchComplete);
            grdPatcher.Children.Add(myPatchProgress);
            rctOverlay.Visibility = Visibility.Visible;
        }
        void myPatchProgress_Loaded(object sender, RoutedEventArgs e)
        {
            PatchProgress iWasLoaded = sender as PatchProgress;

            iWasLoaded.StartPatch();
            if (PatchStarted != null)
            {
                PatchStarted(this, new EventArgs());
            }
        }
        public ClientLauncher(UserPreferences myUserPreferences)
        {
            InitializeComponent();

            _ServerInfo = myUserPreferences.DefaultServerInformation;
            theUserPreferences = myUserPreferences;

            //does this exe even exist yet?
            if (!File.Exists(SWGANHPAth + _ServerInfo.SafeFolderName + "\\swganh.exe"))
            {
                PatchProgress myPatchProgress = new PatchProgress(_ServerInfo, myUserPreferences);
                myPatchProgress.Loaded += new RoutedEventHandler(myPatchProgress_Loaded);
                myPatchProgress.OnError += new EventHandler<ErrorMessageEventArgs>(myPatchProgress_OnError);
                myPatchProgress.PatchComplete += new EventHandler<Patcher.PatchFunctionCompleteEventArgs>(myPatchProgress_PatchComplete);
                grdRightPanel.Children.Clear();
                grdRightPanel.Children.Add(myPatchProgress);
                btnLaunchClient.IsEnabled = false;

            }
            else
            {
                //read the first article
                RefreshNewsDelegate del = new RefreshNewsDelegate(RefreshNewsAsych);

                AsyncCallback callback = new AsyncCallback(XMLHasFinished);
                del.BeginInvoke(_ServerInfo.RSSFeedUrl, callback, null);
            }

            lblServerName.Text = _ServerInfo.ServerName;
            lblServerBuild.Text = "999";
            lblServerPopulation.Text = _ServerInfo.Population.ToString();

            //do we have any credentials for this server?
            if (myUserPreferences.ServerCredentials.Any(sc => sc.ServerId == _ServerInfo.ServerId))
            {
                cboUsername.ItemsSource = myUserPreferences.ServerCredentials.Where(sc => sc.ServerId == _ServerInfo.ServerId);
                cboUsername.SelectedIndex = 0;
            }
        }
示例#4
0
        public ClientLauncher(UserPreferences myUserPreferences)
        {
            InitializeComponent();

            _ServerInfo        = myUserPreferences.DefaultServerInformation;
            theUserPreferences = myUserPreferences;

            //does this exe even exist yet?
            if (!File.Exists(SWGANHPAth + _ServerInfo.SafeFolderName + "\\swganh.exe"))
            {
                PatchProgress myPatchProgress = new PatchProgress(_ServerInfo, myUserPreferences);
                myPatchProgress.Loaded        += new RoutedEventHandler(myPatchProgress_Loaded);
                myPatchProgress.OnError       += new EventHandler <ErrorMessageEventArgs>(myPatchProgress_OnError);
                myPatchProgress.PatchComplete += new EventHandler <Patcher.PatchFunctionCompleteEventArgs>(myPatchProgress_PatchComplete);
                grdRightPanel.Children.Clear();
                grdRightPanel.Children.Add(myPatchProgress);
                btnLaunchClient.IsEnabled = false;
            }
            else
            {
                //read the first article
                RefreshNewsDelegate del = new RefreshNewsDelegate(RefreshNewsAsych);

                AsyncCallback callback = new AsyncCallback(XMLHasFinished);
                del.BeginInvoke(_ServerInfo.RSSFeedUrl, callback, null);
            }

            lblServerName.Text       = _ServerInfo.ServerName;
            lblServerBuild.Text      = "999";
            lblServerPopulation.Text = _ServerInfo.Population.ToString();

            //do we have any credentials for this server?
            if (myUserPreferences.ServerCredentials.Any(sc => sc.ServerId == _ServerInfo.ServerId))
            {
                cboUsername.ItemsSource   = myUserPreferences.ServerCredentials.Where(sc => sc.ServerId == _ServerInfo.ServerId);
                cboUsername.SelectedIndex = 0;
            }
        }
        void theControl_Checked(object sender, RoutedEventArgs e)
        {
            ServerInfo theServerInfo = null;
            brdServerInfo.Visibility = Visibility.Visible;
            ServerSelector theServer = sender as ServerSelector;
            if (theServer == null)
            {
                RadioButton rbIWasSelected = sender as RadioButton;
                theServerInfo = rbIWasSelected.DataContext as ServerInfo;
            }
            else
            {
                theServerInfo = theServer.TheServerInfo;
            }

            grdPatcher.Children.Clear();
            PatchProgress myPatchProgress = new PatchProgress(theServerInfo, myUserPrefs);
            myPatchProgress.DataContext = this.DataContext;
            myPatchProgress.Loaded += new RoutedEventHandler(myPatchProgress_Loaded);
            myPatchProgress.OnError += new EventHandler<ErrorMessageEventArgs>(myPatchProgress_OnError);
            myPatchProgress.PatchComplete += new EventHandler<Patcher.PatchFunctionCompleteEventArgs>(myPatchProgress_PatchComplete);
            grdPatcher.Children.Add(myPatchProgress);
            rctOverlay.Visibility = Visibility.Visible;
        }