C# (CSharp) Class System.Windows. RoutedEventArgs Code Examples

C# (CSharp) System.Windows.RoutedEventArgs - 30 examples found. These are the top rated real world C# (CSharp) examples of class System.Windows.RoutedEventArgs extracted from open source projects. You can rate examples to help us improve the quality of examples
Inheritance: EventArgs, INativeEventObjectWrapper, IRefContainer
 private void btnCancelWorker_Click(object sender, RoutedEventArgs e)
 {
     Trace("btnCancelWorker_Click");
     t.Abort();
     btnStartWorker.IsEnabled = true;
     btnCancelWorker.IsEnabled = false;
 }
Example #2
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            ++equationsCount;
            string xamlTextBox = XamlWriter.Save(t1);
            StringReader stringReader = new StringReader(xamlTextBox);
            XmlReader xmlReader = XmlReader.Create(stringReader);
            TextBox newTextBox = (TextBox)XamlReader.Load(xmlReader);
            newTextBox.Name = "t" + equationsCount.ToString();
            newTextBox.Text = "";
            newTextBox.LostFocus += textBox_LostFocus;
            newTextBox.Margin = new Thickness(0, 29*(equationsCount-1) + 4, 6, 0);

            grid2.Children.Add(newTextBox);

            string xamlLabel = XamlWriter.Save(label2);
            stringReader = new StringReader(xamlLabel);
            xmlReader = XmlReader.Create(stringReader);
            Label newLabel = (Label)XamlReader.Load(xmlReader);
            newLabel.Name = "label" + (equationsCount*2).ToString();
            newLabel.Content = equationsCount.ToString() +":";
            newLabel.Margin = new Thickness(6, 29 * (equationsCount-1) + 4, 0, 0);

            grid2.Children.Add(newLabel);

            varForEq.Add(new List<string>());
        }
        /// <summary>
        ///     Handles the Click event of the btnDelete control. Deletes all the specified Team Box Score, as well as any corresponding
        ///     Player Box Scores, from the database.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">
        ///     The <see cref="RoutedEventArgs" /> instance containing the event data.
        /// </param>
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            var r =
                MessageBox.Show(
                    "Are you sure you want to delete this/these box score(s)?\n" + "This action cannot be undone.\n\n"
                    + "Any changes made to Team Stats by automatically adding this/these box score(s) to them won't be reverted by its deletion.",
                    "NBA Stats Tracker",
                    MessageBoxButton.YesNo);
            if (r == MessageBoxResult.Yes)
            {
                foreach (var bse in dgvBoxScores.SelectedItems.Cast<BoxScoreEntry>().ToList())
                {
                    if (bse != null)
                    {
                        var id = bse.BS.ID;

                        _db.Delete("GameResults", "GameID = " + id);
                        _db.Delete("PlayerResults", "GameID = " + id);
                    }

                    _bsHist.Remove(bse);
                    MainWindow.BSHist.Remove(bse);
                }
            }
        }
        private async void LoginButtonClicked(object sender, RoutedEventArgs e)
        {
            Button buttonClicked = sender as Button;
            if (buttonClicked != null)
            {
                String testName = null;
                MobileServiceAuthenticationProvider provider =
                    MobileServiceAuthenticationProvider.MicrosoftAccount;

                if (buttonClicked.Name.Contains("MicrosoftAccount"))
                {
                    provider = MobileServiceAuthenticationProvider.MicrosoftAccount;
                    testName = "Microsoft Account Login";
                }
                else if (buttonClicked.Name.Contains("Facebook"))
                {
                    provider = MobileServiceAuthenticationProvider.Facebook;
                    testName = "Facebook Login";
                }
                else if (buttonClicked.Name.Contains("Twitter"))
                {
                    provider = MobileServiceAuthenticationProvider.Twitter;
                    testName = "Twitter Login";
                }
                else if (buttonClicked.Name.Contains("Google"))
                {
                    provider = MobileServiceAuthenticationProvider.Google;
                    testName = "Google Login";
                }

                bool useProviderStringOverload = UseProviderStringOverloadCheckBox.IsChecked.Value;

                TestResultsTextBlock.Text = await LoginTests.ExecuteTest(testName, () => LoginTests.TestLoginAsync(provider, useProviderStringOverload));
            }
        }
Example #5
0
        /// <summary>
        /// Tests for Vektor class
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnVector_Click(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
            watch.Start();
            txtVector.Text = "Starting test suite for the Vektor class.\r\n\r\n";

            // Sample data
            List<Eksam.Vektor> vectors = new List<Vektor>{
                new Vektor(),
                new Vektor(1,1),
                new Vektor(0,1),
                new Vektor(2.2, 1.2),
                new Vektor(10,-4),
                null
            };

            // Go over all defined operations and input combinations
            foreach (Vektor vector in vectors)
            {
                foreach (Vektor secondVector in vectors)
                {
                    txtVector.Text += vector + " + " + secondVector + " = " + (vector + secondVector) + "\r\n";
                    txtVector.Text += vector + " - " + secondVector + " = " + (vector - secondVector) + "\r\n";
                    txtVector.Text += vector + " == " + secondVector + " ... " + (vector == secondVector) + "\r\n";
                    txtVector.Text += vector + vector + " (length " + (vector == null ? 0 : vector.Length()) + ") > " + secondVector + " (length " + (secondVector == null ? 0 : secondVector.Length()) + ")" + " ... " + (vector > secondVector) + "\r\n";
                    txtVector.Text += vector + vector + " (length " + (vector == null ? 0 : vector.Length()) + ") < " + secondVector + " (length " + (secondVector == null ? 0 : secondVector.Length()) + ")" + " ... " + (vector < secondVector) + "\r\n";
                }
            }

            watch.Stop();
            double elapsed = watch.ElapsedMilliseconds;
            txtVector.Text += "\r\nTest suite finished, time elapsed: " + elapsed + "ms.";
        }
Example #6
0
 // Load data for the ViewModel Items
 private void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     if (!App.ViewModel.IsDataLoaded)
       {
     App.ViewModel.LoadData();
       }
 }
 /// <summary>
 /// Handles the Unloaded event of the _page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 void _page_Unloaded(object sender, RoutedEventArgs e)
 {
     _page.Loaded -= _page_Loaded;
     _page.Unloaded -= _page_Unloaded;
     
     App.Instance.ApplicationWindow.WindowBackgroundContent.Visibility = Visibility.Visible;
 }
        private void FolderStore_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog FolderDialog = new FolderBrowserDialog();
            FolderDialog.ShowDialog();

            FolderSave = FolderDialog.SelectedPath;
        }
 private void Help_Click(object sender, RoutedEventArgs e)
 {
     var help = new System.Diagnostics.Process();
     help.StartInfo.FileName = @"Archiver Revolution.chm";
     help.StartInfo.UseShellExecute = true;
     help.Start();
 }
Example #10
0
 private void StartClick(object sender, RoutedEventArgs e)
 {
     if (!_colorClient.IsConnected)
         _colorClient.Connect(ServerIp.Text, 4530);
     else
         _colorClient.Disconnect();
 }
 private void Button_OnClick(object sender, RoutedEventArgs e)
 {
     if (_isSettingsOpen)
         CloseSettings();
     else
         OpenSettings();
 }
Example #12
0
 private void chkOwnsJournal_Click(object sender, RoutedEventArgs e)
 {
     if (chkOwnsJournal.IsChecked == true)
         embeddedFrame.JournalOwnership = JournalOwnership.OwnsJournal;
     else
         embeddedFrame.JournalOwnership = JournalOwnership.UsesParentJournal;
 }
Example #13
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     image1.Source = null;
     PhotoChooserTask objPhotoChooser = new PhotoChooserTask();
     objPhotoChooser.Completed += new EventHandler<PhotoResult>(PhotoChooseCall);
     objPhotoChooser.Show();
 }
Example #14
0
        //XPotion
        private void btnButXPotion_Click(object sender, RoutedEventArgs e)
        {
            Shield.Visibility = System.Windows.Visibility.Collapsed;
            HealthPotion.Visibility = System.Windows.Visibility.Collapsed;
            Xpotion.Visibility = System.Windows.Visibility.Visible;
            ManaPotion.Visibility = System.Windows.Visibility.Collapsed;
            HolyWater.Visibility = System.Windows.Visibility.Collapsed;
            Lightning.Visibility = System.Windows.Visibility.Collapsed;
            Drain.Visibility = System.Windows.Visibility.Collapsed;
            Fire.Visibility = System.Windows.Visibility.Collapsed;
            Ice.Visibility = System.Windows.Visibility.Collapsed;
            Heal.Visibility = System.Windows.Visibility.Collapsed;
            Quake.Visibility = System.Windows.Visibility.Collapsed;
            Scan.Visibility = System.Windows.Visibility.Collapsed;
            Dark.Visibility = System.Windows.Visibility.Collapsed;
            GunSlinger.Visibility = System.Windows.Visibility.Collapsed;
            Poison.Visibility = System.Windows.Visibility.Collapsed;
            Thunder.Visibility = System.Windows.Visibility.Collapsed;
            Inferno.Visibility = System.Windows.Visibility.Collapsed;
            Blizzard.Visibility = System.Windows.Visibility.Collapsed;
            CureAll.Visibility = System.Windows.Visibility.Collapsed;
            CounterAttack.Visibility = System.Windows.Visibility.Collapsed;
            Earth.Visibility = System.Windows.Visibility.Collapsed;
            FallenAngel.Visibility = System.Windows.Visibility.Collapsed;
            //Gives information about potion
            itemSelected = 2;
            canvasDescriptionOfItemAndToBuy.Visibility = System.Windows.Visibility.Visible;

            txtItemAndDescription.Text = "A Middle end remedy that will replenish 350 Health";
            txtPointsForItemToBuy.Text = "300";
        }
Example #15
0
        private void ResolveKotusResults(object sender, RoutedEventArgs e)
        {
            var resolveFromKotus = Module1.resolveFromKotus(textBox1.Text);
            textBlock1.Text = "";
            /*for (var i = 0; i < resolveFromKotus.Count(); i++)
            {
                textBlock1.Text += resolveFromKotus.ElementAt(i) + ", ";
                textBlock1.Text += i%8 == 0 ? "\n" : "";
            }*/
            int ui = 0;

            var splits = from name in resolveFromKotus
                         group name by ui++ < 8 into part
                         select part.AsEnumerable().Aggregate(((x, y) => x + ", " + y));
            var f = resolveFromKotus.Where((x, i) => i % 8 == 0).Select((x, i) => resolveFromKotus.Skip(i * 8).Take(8));
            var joined = f.Select(chunk => chunk.Aggregate(((x, y) => x + ", " + y)));
            foreach (var result in joined)
            {
                textBlock1.Text += result + "\n";
            }

            // from x in resolveFromKotus
            /*while(resolveFromKotus.Any())
            {
                var enumerable = resolveFromKotus.Take(5);
                textBlock1.Text += enumerable.Aggregate((x, y) => x + ", " + y);
                resolveFromKotus.Skip(5);
            }
             */
        }
 private void btn_Delete_Click_1(object sender, RoutedEventArgs e)
 {
     if (grd_Behaviour.SelectedItem != null)
     {
         behaviour = (Behaviour)grd_Behaviour.SelectedItem;
         MessageBoxResult result = MessageBox.Show("هل انت متأكد من حذف " + behaviour.Name, "حذف النشاط", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (result == MessageBoxResult.Yes)
         {
             behaviourDomain.Delete(behaviour);
             if (behaviourDomain.ActionState.Status == Common.Enums.ActionStatusEnum.NoError)
             {
                 MessageBox.Show("تم الحذف بنجاح", "حذف النشاط", MessageBoxButton.OK, MessageBoxImage.Information);
                 behaviourList.Remove(behaviour);
                 grd_Behaviour.ItemsSource = null;
                 grd_Behaviour.ItemsSource = behaviourList;
                 Clear();
             }
             else
             {
                 MessageBox.Show(behaviourDomain.ActionState.Result, "حذف النشاط", MessageBoxButton.OK, MessageBoxImage.Error);
                 Clear();
             }
         }
     }
 }
        private void RadioButton_Checked(object sender, RoutedEventArgs e)
        {
            var button = sender as RadioButton;

            if (button.Content.ToString().Contains("Windows"))
            {
                this.lineEndings = LineEndingsChanger.LineEndings.Windows;
            }
            else if (button.Content.ToString().Contains("Linux"))
            {
                this.lineEndings = LineEndingsChanger.LineEndings.Linux;
            }
            else if (button.Content.ToString().Contains("Macintosh"))
            {
                this.lineEndings = LineEndingsChanger.LineEndings.Macintosh;
            }
            else if (button.Content.ToString().Contains("Dominant"))
            {
                this.lineEndings = LineEndingsChanger.LineEndings.Dominant;
            }
            else
            {
                this.lineEndings = LineEndingsChanger.LineEndings.None;
            }
        }
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            CollectionViewSource modelTypesViewSource = (CollectionViewSource)this.Resources["modelTypesCollectionViewSource"];
            modelTypesViewSource.Source = ViewModel.ModelTypeCollection;

            ModelBox.SelectedIndex = -1;
        }
Example #19
0
 private void webBrowser1_Loaded(object sender, RoutedEventArgs e)
 {
     //string site = "http://www.allyou.com/diet-fitness/at-home-workouts/lose-weight-00400000048774/page2.html";
     string site = "http://m.youtube.com/watch?v=whmUeG0saAM&fulldescription=1";
     //string site = "http://www.exercise.com/exercise/run-in-place";
     //webBrowser1.Navigate(new Uri(site, UriKind.Absolute));
 }
 private void DocumentContentLoaded(object sender, RoutedEventArgs e)
 {
     dynamic dataContext = DataContext;
     dataContext.Console = TxtConsole;
     dataContext.CommandText = TxtUserCommand;
     TxtUserCommand.Focus();
 }
Example #21
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {            
            if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
                return;

            stopping = false;
            InsteonService.Network.Connected += Network_Connected;
            InsteonService.ConnectionFailed += InsteonService_ConnectionFailed;
            InsteonService.Network.ConnectProgress += Network_ConnectProgress;

            if (!InsteonService.Network.IsConnected)
            {
                InsteonService.StartNetwork();

                // Only show progress controls when trying multiple connections, not when connecting to a specific connection...
                if (InsteonService.SpecificConnection != null)
                    HideProgressControls();

                // If there's a last connection status then use it to set the initial on-screen progress
                if (InsteonService.Network.LastConnectStatus != null) 
                {
                    progressBar.Value = InsteonService.Network.LastConnectStatus.ProgressPercentage;
                    statusTextBlock.Text = InsteonService.Network.LastConnectStatus.Status;
                }
            }
            else
            {
                InsteonService.Network.VerifyConnection(); // note: page frame will react on disconnect event if verification fails
                ShowNextPage();
            }
        }
 void CustomMarkerDemo_Loaded(object sender, RoutedEventArgs e)
 {
    if(icon.Source.CanFreeze)
    {
       icon.Source.Freeze();
    }
 }
 private void Button2_Click(object sender, RoutedEventArgs e)
 {
     string target = "/FullScreenPlayer.xaml";
     target += string.Format("?SourceURI={0}", Uri.EscapeDataString("http://www.nasa.gov/multimedia/nasatv/NTV-Public-IPS.m3u8"));
     GC.Collect();
     NavigationService.Navigate(new Uri(target, UriKind.Relative));
 }
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(txtTaskName.Text) || String.IsNullOrEmpty(txtWorksheetUrl.Text))
            {
                MessageBox.Show("Task Name or Worksheet URL cannot be empty");
                return;
            }
            using (var context = new WorkDeskManager.Desktop.Data.WorkdeskContext())
            {

                try
                {
                    var task = new Data.Task { Name = txtTaskName.Text.Trim(), WorksheetUrl = txtWorksheetUrl.Text.Trim() };
                    context.Tasks.Add(task);
                    context.SaveChanges();
                    MessageBox.Show(String.Format("Task -{0}- Added",txtTaskName.Text));
                }
                catch (Exception ex)
                {

                    MessageBox.Show(String.Format("Error adding new task: {0}",ex.Message));
                }
            }

            Close();
        }
Example #25
0
 void FacebookLoginBrowser_Loaded(object sender, RoutedEventArgs e)
 {
     if (!loggedIn)
     {
         LoginToFacebook();
     }
 }
        private void cancelButtonClicked(object sender, RoutedEventArgs e)
        {

            OKButton.IsEnabled = false;
            DialogResult = false;

        }
        private void btnMessage_Comment_Browse_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ClGlobul.CommentMessagesList.Clear();

                txtCommentMessage.IsReadOnly = true;
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.DefaultExt = ".txt";
                dlg.Filter = "Text documents (.txt)|*.txt";
                Nullable<bool> result = dlg.ShowDialog();
                if (result == true)
                {
                    txtCommentMessage.Text = dlg.FileName.ToString();
                }
                try
                {
                    ClGlobul.CommentMessagesList = GlobusFileHelper.ReadFile(txtCommentMessage.Text.Trim());
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Info(" Please Select File ");
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
            }
        }
        private void Button_UsingBeginInvoke(object sender, RoutedEventArgs e)
        {
            IAsyncResult result = mydelegate.BeginInvoke(5000, null, null);

            // Do some work while the asynchronous operation runs
            this.TextBox_UsingBeginInvoke.Text = mydelegate.EndInvoke(result);
        }
Example #29
0
 void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     #region 加载登录人员信息         
     Utility.CurrentUser = new Saas.Tools.PermissionWS.T_SYS_USER();
     Utility.CurrentUser.CREATEDATE = DateTime.Now;
     Utility.CurrentUser.CREATEUSER = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
     Utility.CurrentUser.EMPLOYEECODE = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeCode;
     Utility.CurrentUser.EMPLOYEEID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
     Utility.CurrentUser.EMPLOYEENAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;     
     Utility.CurrentUser.OWNERCOMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;           
     Utility.CurrentUser.OWNERDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
     Utility.CurrentUser.OWNERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
     Utility.CurrentUser.OWNERPOSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;        
     Utility.CurrentUser.STATE = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeState;
     Utility.CurrentUser.SYSUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID;          
     Utility.CurrentUser.UPDATEDATE = DateTime.Now;
     Utility.CurrentUser.UPDATEUSER = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
     Utility.CurrentUser.USERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
     if (Application.Current.Resources["CurrentUserID"] == null)
     {
         Application.Current.Resources.Add("CurrentUserID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
     }
    
     #endregion
     //发布时下面代码要注释
     //System.Windows.Controls.Window.Parent = windowParent;
     //System.Windows.Controls.Window.TaskBar = new StackPanel();
     //System.Windows.Controls.Window.Wrapper = this;
     //System.Windows.Controls.Window.IsShowtitle = false;
 }
        private void searchButton_Click(object sender, RoutedEventArgs e)
        {
            if(!clear)
            {
                string search = srcBox.Text;

                playerBox.Items.Clear();

                foreach (Player p in Brain.MyDraft.Players.Where(p => p.Last.ToLower().StartsWith(search.ToLower())))
                {
                    playerBox.Items.Add(p.toBox());
                }

                clear = true;
                searchButton.Content = "Clear";
            }
            else
            {
                playerBox.Items.Clear();
                srcBox.Text = string.Empty;

                foreach (Player p in Brain.MyDraft.Players)
                {
                    playerBox.Items.Add(p.toBox());
                }

                clear = false;
                searchButton.Content = "Search";
            }
           
        }