示例#1
0
        void MainPage_Unloaded(object sender, RoutedEventArgs e)
        {
            // If the app is running outside of the debugger then report the exception using a ChildWindow control.
            if (!System.Diagnostics.Debugger.IsAttached)
            {
                // NOTE: This will allow the application to continue running after an exception has been thrown but not handled.
                // For production applications this error handling should be replaced with something that will report the error to the website and stop the application.

                ErrorWindow.CreateNew(e.ToString());
            }
        }
示例#2
0
 private void createNewGame(object sender, RoutedEventArgs e)
 {
     log.Debug("createNewGame(object: "+ sender.ToString() + " RoutedEventArgs: " +e.ToString() + ") - Begin");
     hideStacksPot();
     Btn4.Visibility = Visibility.Hidden;
     Mitte.Visibility = Visibility.Hidden;
     SVIWinner.Visibility = Visibility.Hidden;
     //Hide Startbtn
     if (Grid.Children.Contains(btn))
     {
         Grid.Children.Remove(btn);
     }
     addplayerscatteru.Visibility = Visibility.Hidden;
     playerName.Text = "";
     hideUI();
     hideActionButton();
     round = 0;
     personalStack = 0;
     showCardDelay = 1500;
     canAddPlayer = true;
     canChangeStack = true;
     EMIchangeStack.IsEnabled = true;
     //if no stack value is given set default
     if (stack == 0)
     {
         stack = 1000;
     }
     mainPot.Text = "Touch Grey Area To Create A New Player!             Player Stacks: " + stack.ToString() + "\n";
     players = new List<Player>();
     gl = null;
     EMIcancelRound.IsEnabled = false;
     log.Debug("createNewGame() - End");
     e.Handled = true;
 }
示例#3
0
        /// <summary>
        /// change player stacks, updates stacks from all existing players 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void setStack(object sender, RoutedEventArgs e)
        {
            log.Debug("setStack(object " + sender.ToString() + " RoutedEventArgs " + e.ToString() + ") - Begin");
            if (canChangeStack)
            {
                ElementMenuItem emi = sender as ElementMenuItem;
                string t = emi.Header.ToString();
                stack = (Int32)Convert.ToInt32(emi.Header.ToString().Split(' ')[1]);
                mainPot.Text = "Player Stacks: " + stack.ToString() + "\n";
                if (players.Exists(x => x.stack != stack))
                {
                    foreach (Player p in players) {
                        p.stack = stack;                    
                    }

                }
            }
            log.Debug("setStack() - End");
            e.Handled = true;
        }
示例#4
0
 /// <summary>
 /// set personal stack to 0, undo bet in bet area
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void resetPersonalStack(object sender, RoutedEventArgs e)
 {
     log.Debug("resetPersonalStack(object " + sender.ToString() + " RoutedEventArgs " + e.ToString() + ") - Begin");
     personalStack = 0;
     oneChipCall = true;
     checkCash(kvp.Key.position);
     setActionButtonText();
     log.Debug("resetPersonalStack() - End");
     e.Handled = true;
 }
示例#5
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     string s = null;
     s.Trim();
     MessageBox.Show("You click me at " + e.ToString());
 }
示例#6
0
 private void SearchPanel_SearchInitiated(object sender, RoutedEventArgs e)
 {
     MessageBox.Show("Search Initiated Handled At Search Panel ... " + e.ToString());
 }
示例#7
0
        /// <summary>
        /// catches event when action button is clicked. eg: call 100, fold
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void actionButtonClicked(object sender, RoutedEventArgs e)
        {
            log.Debug("actionButtonClicked(object: " + sender.ToString() + " , RoutedEventsArgs: " + e.ToString() + ") - Begin");
            Button s = (Button)sender;
            switch (s.Content.ToString().Split(' ')[0])
            {
                case "fold":
                    gl.activeAction(Action.playerAction.fold, 0);
                    foldCards(kvp.Key.position);
                    playSound("karte_ablegen");
                    break;
                case "check":
                    gl.activeAction(Action.playerAction.check, 0);
                    playSound("knock2");
                    break;
                case "call":
                    gl.activeAction(Action.playerAction.call, (Int32)Convert.ToInt32(s.Content.ToString().Split(' ')[1]));
                    playSound("einsatz");
                    break;
                case "bet":
                    gl.activeAction(Action.playerAction.bet, (Int32)Convert.ToInt32(s.Content.ToString().Split(' ')[1]));
                    playSound("einsatz");
                    break;
                case "raise":
                    gl.activeAction(Action.playerAction.raise, (Int32)Convert.ToInt32(s.Content.ToString().Split(' ')[1]));
                    playSound("einsatz3");
                    break;
            }
            hideActionButton();
            hideChips();
            updateBalance();
            await UInextPlayer();

            log.Debug("actionButtonClicked() - End");
        }
示例#8
0
 /// <summary>
 /// Hides the sender Window, sender has to be a Button in StackPanel, ScatterViewItem
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void closeWindow(object sender, RoutedEventArgs e)
 {
     log.Debug("closeWindow(object: " + sender.ToString() + " RoutedEventArgs: " + e.ToString() + ") - Begin");
     Button s = sender as Button;
     StackPanel stackPanel = s.Parent as StackPanel;
     if (stackPanel == null)
     {
         DockPanel dockPanel = s.Parent as DockPanel;
         stackPanel = dockPanel.Parent as StackPanel;
     }
     ScatterViewItem SVI = stackPanel.Parent as ScatterViewItem;
     log.Debug("closing " + SVI.Name);
     if (SVI.Name == "addplayerscatteru")
     {
         //clean up
         SurfaceTextBox text = (SurfaceTextBox)stackPanel.FindName("playerName");
         text.Text = "";
         Label l = this.FindName("LabelAddPlayer") as Label;
         l.Foreground = Brushes.White;
         l.Content = "Add New Player";
     }
     SVI.Visibility = Visibility.Hidden;
     log.Debug("closeWindow() - End");
     e.Handled = true;
 }
示例#9
0
        /// <summary>
        /// Event handler for the download progress event from the media element.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event args.</param>
        void OnMediaElementDownloadProgressChanged(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine("OnMediaElementDownloadProgressChanged:" + e.ToString());

            m_downloadProgressNeedsUpdating = true;
        }
示例#10
0
        /// <summary>
        /// Event handler for the media element state changed event.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event args.</param>
        void OnMediaElementCurrentStateChanged(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine("OnMediaElementCurrentStateChanged:" + e.ToString() + " NewState:" + m_mediaElement.CurrentState.ToString());

            MediaElementState currentState = m_mediaElement.CurrentState;
            switch (currentState)
            {
                case MediaElementState.Playing:
                case MediaElementState.Opening:
                case MediaElementState.Buffering:
                case MediaElementState.AcquiringLicense:
                    {
                        m_elementPlay.Visibility = Visibility.Collapsed;
                        m_elementPause.Visibility = Visibility.Visible;
                        break;
                    }

                case MediaElementState.Paused:
                case MediaElementState.Stopped:
                case MediaElementState.Closed:
                    {
                        m_elementPlay.Visibility = Visibility.Visible;
                        m_elementPause.Visibility = Visibility.Collapsed;
                        break;
                    }

                default:
                    break;
            }

            UpdateBufferingControls();

            if (StateChanged != null)
            {
                StateChanged(sender, e);
            }
        }
示例#11
0
        //计算关键层和竖三带
        private void click_showKeyRow(object sender, RoutedEventArgs e)
        {
            //先撤销之前的变色
            foreach (KeyLayerParams nbr in keyLayers)
            {
                layers[nbr.ycbh - 1].IsKeyLayer = false;
            }

            //当前关键层变色显示
            int[] biaoHaoList = null;
            double[] pjxsList = null;
            bool isOk = getKeyLayer(ref biaoHaoList, ref pjxsList);

            if(!isOk)
            {
                return;
            }
            else if (biaoHaoList == null || pjxsList == null)
            {
                MessageBox.Show("未计算出关键层,请检查数据合理性");
                return;
            }

            keyLayers.Clear();
            int count = biaoHaoList.Length;
            for (int i = 0; i < count; i++)
            {
                KeyLayerParams layer = new KeyLayerParams(this);
                layer.ycbh = biaoHaoList[i];
                layer.fypjxs = pjxsList[i];

                layer.ycsd = layers[biaoHaoList[i] - 1].LeiJiShenDu;
                layer.mcms = layers[biaoHaoList[i] - 1].JuLiMeiShenDu;
                layer.fypjxsxz = layer.fypjxs * pjxsxz;
                keyLayers.Add(layer);

                layers[biaoHaoList[i] - 1].IsKeyLayer = true;
            }

            //竖三带计算
            try
            {
                var array1 = (MWNumericArray)logic.calHm(FuYanXCL, CaiGao, SuiZhangXS, Mcqj);
                double maoLuoDai = array1.ToScalarDouble();
                maoLuoDaiTb.Text = maoLuoDai.ToString("f3");
                var array2 = (MWNumericArray)logic.calHl(CaiGao, 1);
                double lieXiDai = array2.ToScalarDouble();
                lieXiDaiTb.Text = lieXiDai.ToString("f3");

                bool bWanquDai = false;
                for (int i = keyLayers.Count; i > 0; i--)
                {
                    if (keyLayers[i - 1].ycsd > lieXiDai)
                    {
                        continue;
                    }
                    bWanquDai = true;
                    wanQuDaiIndex = i - 1;
                    double wanquDai = keyLayers[i - 1].ycsd;
                    wanQuDaiTb.Text = wanquDai.ToString("f3");
                    break;
                }
                if(!bWanquDai)
                {
                    MessageBox.Show("没有找到弯曲带,请检查数据合理性");
                }
            }
            catch (Exception)
            {
                e.ToString();
                MessageBox.Show("竖三带计算出错,请检查数据合理性");
            }
        }
示例#12
0
 private void btnOpenDocFolder_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
     string hi = e.ToString();
     lblLabel.Content = hi;
     }
     catch (Exception ex)
     {
     lblLabel.Content = ex.Message;
     throw;
     }
 }
        private void onClickAddAppointment(object sender, RoutedEventArgs e)
        {
            appointment = AppointmentFacade.CreateAppointment();

            try
            {
                appointment.Name = txtboxNavn.Text;
                appointment.Description = txtboxBeskrivelse.Text;

                TimeSpan tidspunkt;
                TimeSpan.TryParse(txtboxTidspunkt.Text, out tidspunkt);

                if (dpStartDate.SelectedDate != null)
                {
                    appointment.StartDate = dpStartDate.SelectedDate.Value.Add(tidspunkt);
                }
                else
                {
                    appointment.StartDate = DateTime.Now;
                }

                int freq;
                int.TryParse(txtboHyppighed.Text, out freq);
                appointment.Frequency = freq;

                double price;
                double.TryParse(txtboxPris.Text, out price);
                appointment.Price = price;

                appointment.City = txtboxBy.Text;
                appointment.ZipCode = txtboxPostnr.Text;
                appointment.Address = txtboxAddresse.Text;

                //appointments.Add(appointment);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                MessageBox.Show("Fejl! " + e.ToString());
            }

            Close();
        }
示例#14
0
 private void XAppWebView_Unloaded(object sender, RoutedEventArgs e)
 {
     XLog.WriteInfo("XAppWebView_Unloaded :: " + e.ToString());
 }
示例#15
0
 private void Window_SearchInitiated(object sender, RoutedEventArgs e)
 {
     MessageBox.Show("Search Initiated Handled At Window ... " + e.ToString());
 }
示例#16
0
        private void showAddPlayer(object sender, RoutedEventArgs e)
        {
            log.Debug("openAddPlayer(object: " + sender.ToString() + " RoutedEventArgs: " + e.ToString() + ") - Begin");
            if (canAddPlayer) {
                
                //clean up
                SurfaceTextBox tb = this.FindName("playerName") as SurfaceTextBox;
                Label l = this.FindName("LabelAddPlayer") as Label;
                l.Foreground = Brushes.White;
                l.Content = "Add New Player";
                tb.Text = "";

                //get Position
                Rectangle r = (Rectangle)sender;
                String name = r.Name;
                Point point = new Point();

                switch (r.Name)
                {
                    case "Pos1": point.X = 270; point.Y = 550; playerPos.Text = "1"; break;
                    case "Pos2": point.X = 470; point.Y = 170; playerPos.Text = "2"; break;
                    case "Pos3": point.X = 1210; point.Y = 170; playerPos.Text = "3"; break;
                    case "Pos4": point.X = 1620; point.Y = 550; playerPos.Text = "4"; break;
                    case "Pos5": point.X = 1210; point.Y = 930; playerPos.Text = "5"; break;
                    case "Pos6": point.X = 470; point.Y = 930; playerPos.Text = "6"; break;
                }

                addplayerscatteru.Center = point;
                addplayerscatteru.Visibility = Visibility.Visible;                
                playerName.Focus();
            }
            log.Debug("openAddPlayer() - End");
            e.Handled = true;
        }
示例#17
0
 /// <summary>
 /// Set the Visibility for HandRanking Window to true
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void showHandRanking(object sender, RoutedEventArgs e)
 {
     log.Debug("showHandRanking(object: " + sender.ToString() + " RoutedEventArgs: " + e.ToString() + ") - Begin");
     HandRanking.Visibility = Visibility.Visible;            
     log.Debug("showHandRanking() - End");
     e.Handled = true;
 }
示例#18
0
 /// <summary>
 /// Event handler for the media ended event from the media element.
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">Event args.</param>
 void OnMediaElementMediaEnded(object sender, RoutedEventArgs e)
 {
     Debug.WriteLine("OnMediaElementMediaEnded:" + e.ToString());
     GoToPlaylistItemOnNextTick(m_currentPlaylistIndex + 1);
 }
示例#19
0
        /// <summary>
        /// Creates new player or updates name if player exists at this position
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void savePlayer(object sender, RoutedEventArgs e)
        {
            log.Debug("savePlayer(object: " + sender.ToString() + " RoutedEventArgs: " + e.ToString() + ") - Begin");
            
            if (canAddPlayer) { 
            
                SurfaceTextBox tb = this.FindName("playerName") as SurfaceTextBox;
                Label l = this.FindName("LabelAddPlayer") as Label;
                int pos = Convert.ToInt32(playerPos.Text);

                //check if player name is taken
                if (players.Exists(x => x.name == tb.Text)) {
                    //player name taken
                    l.Foreground = Brushes.Red;
                    l.Content = "Choose Another Name";
                    tb.Text = "";
                } 
                else
                {
                    if(tb.Text == "") {
                        //player name empty
                        l.Foreground = Brushes.Red;
                        l.Content = "Please Choose A Name";
                        tb.Text = "";
                    }
                    else
                    {
                        if (tb.Text.Length > 20) {
                            //max length at position 2 is 20char
                            l.Foreground = Brushes.Red;
                            l.Content = "Please Use A Short Name";
                            tb.Text = "";
                        }
                        else
                        {
                            setSurfaceName(pos, tb.Text);

                            //check if player allready exits at pos 
                            if (!(players.Exists(x => x.position == pos)))
                            {
                                //add new player at pos
                                players.Add(new Player(tb.Text, stack, pos));
                            }
                            else
                            {
                                //updates Player name at pos
                                players.Find(x => x.position == pos).name = tb.Text;
                            }

                            //clean up
                            l.Foreground = Brushes.White;
                            l.Content = "Add New Player";
                            tb.Text = "";
                            addplayerscatteru.Visibility = Visibility.Hidden;

                            //add start btn if two or more players
                            if (players.Count >= 2)
                            {
                                addStartButton("Start Game");
                            }

                        }
                    }

                }
            }
            log.Debug("savePlayer() - End");
            e.Handled = true;

        }
示例#20
0
        /// <summary>
        /// Event handler for the media opened event from the media element.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event args.</param>
        void OnMediaElementMediaOpened(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine("OnMediaElementMediaOpened:" + e.ToString());

            ShowErrorMessage(null);

            DisplayPoster(-1);
            PerformResize();

            SetPlaybackDuration(m_mediaElement.NaturalDuration.TimeSpan.TotalSeconds);

            UpdateDurationDisplay();

            if (m_inPlayState)
            {
                InternalPlay();
            }

            UpdateCanStep();
        }
示例#21
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            String path = "abc.png";
            WriteableBitmap wbit;
            byte[] pix;
            var isf = IsolatedStorageFile.GetUserStoreForApplication();
            using (var fs = isf.OpenFile(path, System.IO.FileMode.Open, FileAccess.Read))
            {
                var image = new BitmapImage();
                image.SetSource(fs);
               wbit = new WriteableBitmap(image);
               height = (UInt32)wbit.PixelHeight;
                width = (UInt32)wbit.PixelWidth;
               int[] p = wbit.Pixels;
               int len = p.Length * 4;
               pix = new byte[len]; // ARGB
               System.Buffer.BlockCopy(p, 0, pix, 0, len);
            }

                // Extract text from image.

                OcrResult result = await ocrEngine.RecognizeAsync(height, width, pix);
                OcrText.Text = "Here 1";
                // Check whether text is detected.
                if (result.Lines != null)
                {
                    // Collect recognized text.
                    string recognizedText = "";
                    OcrText.Text = "Here 2";

                    foreach (var line in result.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            try {
                                isEmail(word.Text);
                            }
                            catch
                            {
                               OcrText.Text = e.ToString();
                            }
                            recognizedText += word.Text + " ";
                        }
                        recognizedText += System.Environment.NewLine;
                    }

                    // Display recognized text.
                 //   OcrText.Text = recognizedText;
                    await WriteToFile(recognizedText);
               //     await ReadFile();
               

                 //   OcrText.Text = "Here 4";
                }
                else
                {
                    txtDebug.Text = "No Text found";
                }
            }
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            // Data buffer for incoming data.
            byte[] bytes = new byte[1024];
            try
            {
                // Encode the data string into a byte array.
                byte[] msg = Encoding.UTF8.GetBytes(fieldString);

                // Send the data through the socket.
                int bytesSent = m_clientSocket.Send(msg);
                WaitForCommit("POSITION");

            }
            catch (Exception)
            {
                Console.WriteLine(e.ToString());

            }
            //in fieldString ist der Server-friendly string.
        }