public PosDetails(SlotMachine objSlotMachine)
        {
            try
            {
                InitializeComponent();
                SlotMachine = objSlotMachine;
                this.InitCashDispenser();

                LogManager.WriteLog("Inside PosDetails Constructor", LogManager.enumLogLevel.Info);

                if (_SlotMachine.Status == SlotMachineStatus.EmptyPosition || _SlotMachine.Status == SlotMachineStatus.FloatCollection
                    || _SlotMachine.Status == SlotMachineStatus.ForceFinalCollection)
                {
                    DisableControlsIfNoMeters();
                }
                Timer = new System.Windows.Threading.DispatcherTimer();
                Timer.Interval = new TimeSpan(0, 0, Int32.Parse(ConfigManager.Read("RefreshTime").ToString()));
                Timer.IsEnabled = true;
                Timer.Tick += Timer_Tick;
                Timer.Start();
                LogManager.WriteLog("PosDetails Timer started from Constructor", LogManager.enumLogLevel.Info);
                // RefreshSlot();
                // RefreshButtons(_SlotMachine.Status);               

                if (Settings.RegulatoryEnabled && Settings.RegulatoryType == "AAMS" && Settings.MachineMaintenance)
                {
                    rbMachineMaintenance.Visibility = Visibility.Visible;
                    rbMachineMaintenance.Content = FindResource("PosDetails_xaml_rbMachineMaintenance");
                }
                else
                {
                    rbMachineMaintenance.Visibility = Visibility.Collapsed;
                }

            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.ucPosDetails = ((BMC.Presentation.PosDetails)(target));
     return;
     case 2:
     this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.pnlHeader = ((System.Windows.Controls.Grid)(target));
     return;
     case 4:
     this.lblPercentagePayout = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 5:
     this.lblAsset = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 6:
     this.lblBaseDenom = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 7:
     this.lblMaxBet = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 8:
     this.lblCreditValue = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 9:
     this.lblRoute = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 10:
     this.txtRoute = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 11:
     this.lblSerialNo = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 12:
     this.lblManufacturer = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 13:
     this.lblActAsset = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 14:
     this.lblGMU = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 15:
     this.btnExit = ((System.Windows.Controls.Button)(target));
     
     #line 53 "..\..\..\UserControls\PosDetails.xaml"
     this.btnExit.Click += new System.Windows.RoutedEventHandler(this.btn_Exit);
     
     #line default
     #line hidden
     return;
     case 16:
     this.ucSlotMachine = ((BMC.Presentation.SlotMachine)(target));
     return;
     case 17:
     this.lblZoneName = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 18:
     this.rbHandpay = ((System.Windows.Controls.RadioButton)(target));
     
     #line 68 "..\..\..\UserControls\PosDetails.xaml"
     this.rbHandpay.Click += new System.Windows.RoutedEventHandler(this.Handpay_Click);
     
     #line default
     #line hidden
     return;
     case 19:
     this.rbPlayerClub = ((System.Windows.Controls.RadioButton)(target));
     
     #line 69 "..\..\..\UserControls\PosDetails.xaml"
     this.rbPlayerClub.Click += new System.Windows.RoutedEventHandler(this.PlayerClub_Click);
     
     #line default
     #line hidden
     return;
     case 20:
     this.rbFieldService = ((System.Windows.Controls.RadioButton)(target));
     
     #line 70 "..\..\..\UserControls\PosDetails.xaml"
     this.rbFieldService.Click += new System.Windows.RoutedEventHandler(this.FldService_Click);
     
     #line default
     #line hidden
     return;
     case 21:
     this.rbEvents = ((System.Windows.Controls.RadioButton)(target));
     
     #line 71 "..\..\..\UserControls\PosDetails.xaml"
     this.rbEvents.Click += new System.Windows.RoutedEventHandler(this.Events_Click);
     
     #line default
     #line hidden
     return;
     case 22:
     this.rbMachineMeters = ((System.Windows.Controls.RadioButton)(target));
     
     #line 73 "..\..\..\UserControls\PosDetails.xaml"
     this.rbMachineMeters.Click += new System.Windows.RoutedEventHandler(this.MCMeters_Click);
     
     #line default
     #line hidden
     return;
     case 23:
     this.rbCurrentMeters = ((System.Windows.Controls.RadioButton)(target));
     
     #line 74 "..\..\..\UserControls\PosDetails.xaml"
     this.rbCurrentMeters.Click += new System.Windows.RoutedEventHandler(this.MCCurrentMeters_Click);
     
     #line default
     #line hidden
     return;
     case 24:
     this.rbRemoveMachine = ((System.Windows.Controls.RadioButton)(target));
     
     #line 75 "..\..\..\UserControls\PosDetails.xaml"
     this.rbRemoveMachine.Click += new System.Windows.RoutedEventHandler(this.RemoveMachine_Click);
     
     #line default
     #line hidden
     return;
     case 25:
     this.rbMachineMaintenance = ((System.Windows.Controls.RadioButton)(target));
     
     #line 76 "..\..\..\UserControls\PosDetails.xaml"
     this.rbMachineMaintenance.Click += new System.Windows.RoutedEventHandler(this.rbMachineMaintenance_Click);
     
     #line default
     #line hidden
     return;
     case 26:
     this.rbReInstateMachine = ((System.Windows.Controls.RadioButton)(target));
     
     #line 77 "..\..\..\UserControls\PosDetails.xaml"
     this.rbReInstateMachine.Click += new System.Windows.RoutedEventHandler(this.rbReInstateMachine_Click);
     
     #line default
     #line hidden
     return;
     case 27:
     this.rbSyncTicketExpire = ((System.Windows.Controls.RadioButton)(target));
     
     #line 78 "..\..\..\UserControls\PosDetails.xaml"
     this.rbSyncTicketExpire.Click += new System.Windows.RoutedEventHandler(this.SyncTicketExpire_Click);
     
     #line default
     #line hidden
     return;
     case 28:
     this.pnlContent = ((System.Windows.Controls.Grid)(target));
     
     #line 83 "..\..\..\UserControls\PosDetails.xaml"
     this.pnlContent.Loaded += new System.Windows.RoutedEventHandler(this.pnlContent_Loaded);
     
     #line default
     #line hidden
     return;
     case 29:
     this.lblGame = ((System.Windows.Controls.TextBlock)(target));
     return;
     }
     this._contentLoaded = true;
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.UserControl = ((BMC.Presentation.PositionDetailsComp)(target));
     return;
     case 2:
     this.OnLoaded1_BeginStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target));
     return;
     case 3:
     this.pnlLayoutRoot = ((System.Windows.Controls.DockPanel)(target));
     return;
     case 4:
     this.pnlHeader = ((System.Windows.Controls.Grid)(target));
     return;
     case 5:
     this.lblPosition = ((System.Windows.Controls.Label)(target));
     return;
     case 6:
     this.lblGame = ((System.Windows.Controls.Label)(target));
     return;
     case 7:
     this.lblAsset = ((System.Windows.Controls.Label)(target));
     return;
     case 8:
     this.btnExit = ((System.Windows.Controls.Button)(target));
     
     #line 38 "..\..\..\UserControls\PositionDetailsComp.xaml"
     this.btnExit.Click += new System.Windows.RoutedEventHandler(this.btn_Exit);
     
     #line default
     #line hidden
     return;
     case 9:
     this.ucSlotMachine = ((BMC.Presentation.SlotMachine)(target));
     return;
     case 10:
     this.pnlHandpay = ((System.Windows.Controls.Canvas)(target));
     return;
     case 11:
     this.Path_105 = ((System.Windows.Shapes.Path)(target));
     return;
     case 12:
     this.Path_106 = ((System.Windows.Shapes.Path)(target));
     return;
     case 13:
     this.Path_107 = ((System.Windows.Shapes.Path)(target));
     return;
     case 14:
     this.btnHandPayProcess = ((System.Windows.Controls.Button)(target));
     
     #line 68 "..\..\..\UserControls\PositionDetailsComp.xaml"
     this.btnHandPayProcess.Click += new System.Windows.RoutedEventHandler(this.btnHandPayProcess_Click);
     
     #line default
     #line hidden
     return;
     case 15:
     this.Path_109 = ((System.Windows.Shapes.Path)(target));
     return;
     case 16:
     this.Path_110 = ((System.Windows.Shapes.Path)(target));
     return;
     case 17:
     this.Path_111 = ((System.Windows.Shapes.Path)(target));
     return;
     case 18:
     this.lblDate = ((System.Windows.Controls.Label)(target));
     return;
     case 19:
     this.lblTime = ((System.Windows.Controls.Label)(target));
     return;
     case 20:
     this.lblHandPayType = ((System.Windows.Controls.Label)(target));
     return;
     case 21:
     this.lblHandPayValue = ((System.Windows.Controls.Label)(target));
     return;
     case 22:
     this.pnlPlayerClub = ((System.Windows.Controls.Canvas)(target));
     return;
     case 23:
     this.Path_1 = ((System.Windows.Shapes.Path)(target));
     return;
     case 24:
     this.Path_3 = ((System.Windows.Shapes.Path)(target));
     return;
     case 25:
     this.Path_4 = ((System.Windows.Shapes.Path)(target));
     return;
     case 26:
     this.Path_5 = ((System.Windows.Shapes.Path)(target));
     return;
     case 27:
     this.Path_6 = ((System.Windows.Shapes.Path)(target));
     return;
     case 28:
     this.Path_7 = ((System.Windows.Shapes.Path)(target));
     return;
     case 29:
     this.lblPlayerName = ((System.Windows.Controls.Label)(target));
     return;
     case 30:
     this.lblPlayerAccount = ((System.Windows.Controls.Label)(target));
     return;
     case 31:
     this.lblPlayerStatus = ((System.Windows.Controls.Label)(target));
     return;
     case 32:
     this.lblPlayerTimeOfPlay = ((System.Windows.Controls.Label)(target));
     return;
     case 33:
     this.pnlActionButtons = ((System.Windows.Controls.Primitives.UniformGrid)(target));
     return;
     case 34:
     this.btnMeterLife = ((System.Windows.Controls.Button)(target));
     
     #line 154 "..\..\..\UserControls\PositionDetailsComp.xaml"
     this.btnMeterLife.Click += new System.Windows.RoutedEventHandler(this.btnMeterLife_Click);
     
     #line default
     #line hidden
     return;
     case 35:
     this.btnServiceRequest = ((System.Windows.Controls.Button)(target));
     
     #line 155 "..\..\..\UserControls\PositionDetailsComp.xaml"
     this.btnServiceRequest.Click += new System.Windows.RoutedEventHandler(this.btnServiceRequest_Click);
     
     #line default
     #line hidden
     return;
     case 36:
     
     #line 156 "..\..\..\UserControls\PositionDetailsComp.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
     
     #line default
     #line hidden
     return;
     case 37:
     this.btnEnrol = ((System.Windows.Controls.Button)(target));
     
     #line 159 "..\..\..\UserControls\PositionDetailsComp.xaml"
     this.btnEnrol.Click += new System.Windows.RoutedEventHandler(this.btnEnrol_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
 public void ClearChild(SlotMachine slotMachine)
 {
     slotMachine.MouseLeftButtonUp -= SlotMouseUpEvent;
     BindingOperations.ClearAllBindings(slotMachine);
     slotMachine.Dispose();
     slotMachine = null;
 }
 /// <summary>
 /// Clears the slot mouse up event.
 /// </summary>
 /// <param name="newMachine">The new machine.</param>
 internal void ClearSlotMouseUpEvent(SlotMachine newMachine)
 {
     try
     {
         newMachine.MouseLeftButtonUp -= this.SlotMouseUpEvent;
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
        /// <summary>
        /// Sets the slot mouse up event.
        /// </summary>
        /// <param name="newMachine">The new machine.</param>
        internal void SetSlotMouseUpEvent(SlotMachine newMachine)
        {
            // unsubscribe the existing event
            this.ClearSlotMouseUpEvent(newMachine);

            try
            {
                newMachine.MouseLeftButtonUp += this.SlotMouseUpEvent;
                newMachine.MouseLeftButtonUp += this.txtLegend__MouseDown;
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void AddSlotMachineToUI(SlotMachinePair slotPair, SlotMachine newMachine)
        {
            DragCanvas.SetCanBeDragged(newMachine, _allowDragging);
            DispatcherObject parent = LogicalTreeHelper.GetParent(newMachine);

            if (!slotPair.IsAdded ||
                parent == null)
            {
                //if (!Monitor.TryEnter(_floorView._clearLock, 5))
                //{
                //    clearMachines = true;
                //    break;
                //}
                _canvas.Children.Add(newMachine);
                slotPair.IsAdded = true;
            }
        }
        /// <summary>
        /// Refreshes the data.
        /// </summary>
        /// <param name="barPositions">The bar positions.</param>
        public void RefreshData(List<FloorStatusData> barPositions)
        {
            const string PROC = "[RefreshData]";
            double widthmargin = 10;
            double heightmargin = 20;
            var curPos = 1;
            bool clearMachines = false;
            bool groupby = false;
            _dispatcher.Invoke(new Action(
                   delegate()
                   {
                       groupby = _floorView.GroupByMachines;
                   }));
            bool hasPositionSaved = false;
            _floorView._teFloorPositions.Wait(TimeSpan.FromSeconds(30)); // wait for worst case seconds to retrive floor position from exchange server

            int userId = CDOSettings.Current.LoggedInUser.SecurityUserID;
            FloorPositionDto savedPositions = null;            

            try
            {
                // clear all the slot machine groupings
                if (_floorView.DisplayGroupMachines)
                {
                    foreach (var slotMachineGroupItem in _slotMachineGroups.Values)
                    {
                        slotMachineGroupItem.SlotMachineKeys.Clear();
                        if (!groupby)
                            _dispatcher.Invoke(new Action(
                                delegate()
                                {
                                    this.RemoveSlotMachineGroupFromUI(slotMachineGroupItem);
                                }));
                    }
                }

                // add or update the slot machines
                int rowIndex = 1;
                foreach (FloorStatusData position in barPositions)
                {
                    string key = position.Bar_Pos_Name;

                    _dispatcher.Invoke(new Action(
                        delegate()
                        {
                            SlotMachine newMachine = null;
                            SlotMachinePair pair = null;

                            if (_slotMachines.ContainsKey(key))
                            {
                                pair = _slotMachines[key];
                                newMachine = pair.Machine;
                            }
                            else
                            {
                                newMachine = new SlotMachine()
                                {
                                    SlotNumber = Convert.ToInt32(position.Bar_Pos_Name).ToString(),
                                    SlotNumberString = position.Bar_Pos_Name.ToString(),
                                    SlotID = position.Bar_Pos_No,
                                    AssetNumber = position.Asset_No
                                };
                                pair = new SlotMachinePair
                                {
                                    Key = key,
                                    PositionName = position.Bar_Pos_Name,
                                    AssetNo = position.Asset_No,
                                    Machine = newMachine
                                };
                                _slotMachines.Add(key, pair);
                            }

                            // slot status grouping
                            newMachine.SlotStatusString = position.Slot_Status;
                            SlotMachineGroupPair groupPair = null;
                            IList<string> groupItems = null;
                            if (_floorView.DisplayGroupMachines)
                            {
                                if (!_slotMachineGroups.ContainsKey(position.Slot_Status))
                                {
                                    groupPair = new SlotMachineGroupPair()
                                    {
                                        Status = _floorView.GetSlotStatus(position.Slot_Status),
                                        MachineGroup = new SlotMachineGroup()
                                        {
                                            Width = _canvas.Width - 10,
                                            Height = 30,
                                        },
                                        DisplayText = _floorView.GetSlotStatusDecription(position.Slot_Status),
                                    };
                                    _slotMachineGroups.Add(position.Slot_Status, groupPair);
                                }
                                else
                                {
                                    groupPair = _slotMachineGroups[position.Slot_Status];
                                }
                                groupItems = groupPair.SlotMachineKeys;
                                groupItems.Add(key);
                            }

                            // display game name instead of asset no
                            string assetNo = position.Asset_No;
                            if (Settings.DisplayGameNameInFloorView)
                            {
                                assetNo = position.Game_Name;
                            }

                            // Fix for Asset Number not displayed after finishing the Enrollment 
                            pair.AssetNo = assetNo;
                            newMachine.AssetNumber = assetNo;

                            pair.RowIndex = rowIndex++;
                            newMachine.Top = Convert.ToDouble(position.FLOORTOP);
                            newMachine.Left = Convert.ToDouble(position.FLOORLEFT);
                            _floorView.SetSlotMouseUpEvent(newMachine);

                            if (position.Install_No != 0)
                            {
                                newMachine.InstallationNo = position.Install_No;
                                newMachine.IsEventUnCleared = !(newMachine.IsEventUnCleared);
                                newMachine.IsEventUnCleared = (bool)position.UnClearedEvent;
                                newMachine.Status = (SlotMachineStatus)Enum.Parse(typeof(SlotMachineStatus), position.Slot_Status);
                                newMachine.StackerEventReceived = position.StackerEventReceived.HasValue ? position.StackerEventReceived.Value : false;
                                newMachine.IsCollectable = position.IsCollectable < 1;
                                if (newMachine.StackerEventReceived)
                                {
                                    newMachine.OuterRoundColor = Brushes.Goldenrod;
                                    newMachine.InnerRoundColor = Brushes.IndianRed;
                                }
                            }
                            else
                            {
                                newMachine.Status = SlotMachineStatus.EmptyPosition;
                                newMachine.InstallationNo = 0;
                            }
                            if (_floorView.DisplayGroupMachines &&
                                groupPair.MachineGroup.OuterColor == null)
                            {
                                groupPair.MachineGroup.OuterColor = _floorView._slotMachineGroupBgBrush;// newMachine.OuterRoundColor;
                                groupPair.MachineGroup.OuterForeColor = _floorView._slotMachineGroupFgBrush;// newMachine.ForeColorBrush;
                            }
                        }));
                }

                // remove the slot machine
                List<SlotMachinePair> removedMachines = (from a in _slotMachines
                                                         join b in barPositions
                                                         on a.Key equals b.Bar_Pos_Name
                                                         into matched
                                                         from c in matched.DefaultIfEmpty()
                                                         where c == null
                                                         select new SlotMachinePair
                                                         {
                                                             Key = a.Key,
                                                             Machine = a.Value.Machine
                                                         }).ToList();
                if (removedMachines != null)
                {
                    foreach (SlotMachinePair removedMachine in removedMachines)
                    {
                        _dispatcher.Invoke(new Action(
                        delegate()
                        {
                            this.ClearMachine(removedMachine.Machine);
                        }));
                        _slotMachines.Remove(removedMachine.Key);
                    }
                }

                // finally add the slot machines to the UI
                _dispatcher.Invoke(new Action(
                    delegate()
                    {
#if DEBUG
                        Stopwatch watch = new Stopwatch();
                        watch.Start();
#endif

                        try
                        {
                            if (groupby)
                            {
                                // draw the headers
                                int slotPerWidth = Convert.ToInt32((_floorView.Width - SlotMachine.SlotMachineGap) / SlotMachine.SlotMachineWidthGap);
                                int gap = SlotMachine.SlotMachineGap;
                                double y = gap;
                                foreach (var group in _slotMachineGroups)
                                {
                                    string title = group.Key;
                                    SlotMachineGroupPair groupPair = group.Value;
                                    SlotMachineGroup machineGroup = groupPair.MachineGroup;
                                    int slots = groupPair.SlotMachineKeys.Count;

                                    if (slots <= 0)
                                    {
                                        this.RemoveSlotMachineGroupFromUI(groupPair);
                                        continue;
                                    }
                                    this.AddSlotMachineGroupToUI(groupPair);

                                    groupPair.Left = 0;
                                    groupPair.Top = y;
                                    machineGroup.DisplayText = groupPair.DisplayText + " (" + slots.ToString() + ")";
                                    Canvas.SetLeft(machineGroup, groupPair.Left);
                                    Canvas.SetTop(machineGroup, groupPair.Top);
                                    _floorView.CalculateGroupedSlotMachines(groupPair, slotPerWidth);

                                    int row = 0;
                                    int column = 0;
                                    double sx = groupPair.Left + gap;
                                    double sy = groupPair.Top + machineGroup.Height + gap;
                                    foreach (var slotKey in groupPair.SlotMachineKeys)
                                    {
                                        SlotMachinePair slotPair = _slotMachines[slotKey];
                                        SlotMachine newMachine = slotPair.Machine;

                                        if (column >= slotPerWidth)
                                        {
                                            column = 0;
                                            row++;
                                            sx = groupPair.Left + gap;
                                            sy += SlotMachine.SlotMachineHeightGap;
                                        }

                                        Canvas.SetLeft(newMachine, sx);
                                        Canvas.SetTop(newMachine, sy);
                                        this.AddSlotMachineToUI(slotPair, newMachine);

                                        sx += SlotMachine.SlotMachineWidthGap;
                                        column++;
                                    }
                                    y += machineGroup.Height + groupPair.SlotsHeight + 5;
                                }

                                _canvas.Height = y + SlotMachine.SlotMachineGap;
                                _floorView.Border_Bottom.Margin = new Thickness(-50, 0, 0, 0);
                            }
                            else
                            {
                                List<string> orderedData = (from o in _slotMachines
                                                            orderby o.Value.RowIndex
                                                            select o.Key).ToList();
                                if (orderedData.Count > 72)
                                {
                                    _canvas.Height = (barPositions.Count / 12) * 110;
                                    _floorView.Border_Bottom.Width = 780;
                                    _floorView.Border_Bottom.Margin = new Thickness(-50, 0, 0, 0);
                                }

                                foreach (string slotKey in orderedData)
                                {
                                    SlotMachinePair slotPair = _slotMachines[slotKey];
                                    SlotMachine newMachine = slotPair.Machine;
                                    FloorPositionDataDto floorPosition = null;

                                    if (_floorView._floorViewUserLocations)
                                    {
                                        floorPosition = _floorView.GetFloorPosition(newMachine.SlotID);
                                        if (floorPosition != null)
                                        {
                                            newMachine.PositionData = floorPosition;
                                        }
                                    }

                                    UIElement dragging = _canvas.ElementBeingDragged;
                                    bool isDragging = false;
                                    if (dragging != null && dragging == newMachine)
                                    {
                                        isDragging = true;
                                    }

                                    if (!isDragging && _floorView._floorViewUserLocations)
                                    {
                                        if (floorPosition != null)
                                        {
                                            newMachine.Left = floorPosition.Left;
                                            newMachine.Top = floorPosition.Top;
                                            DragCanvas.SetZIndex(newMachine, floorPosition.RowNo);
                                        }
                                    }

                                    if (newMachine != null && !isDragging)
                                    {
                                        if (newMachine.Left > 0 || newMachine.Top > 0)
                                        {
                                            if ((_floorView.chkSortPos.IsChecked.Value) ||
                                                (_floorView.chkSortAsset.IsChecked.Value))
                                            {
                                                newMachine.Top = 0;
                                                newMachine.Left = 0;

                                                // Don't uncomment these lines, we should not reposition the slot machines during loading.
                                                // Slot machines position should be saved only during dragging.
                                                //if (newMachine.Status != SlotMachineStatus.EmptyPosition)
                                                //{
                                                //    _floorView.SaveFloorPosition(newMachine, true, ref hasPositionSaved);
                                                //}
                                                _floorView.CalculatePositionAndPaint(ref widthmargin, ref heightmargin, ref curPos, newMachine);
                                            }
                                            else
                                            {
                                                Canvas.SetLeft(newMachine, Convert.ToDouble(newMachine.Left));
                                                Canvas.SetTop(newMachine, Convert.ToDouble(newMachine.Top));
                                            }
                                        }
                                        else
                                        {
                                              _floorView.CalculatePositionAndPaint(ref widthmargin, ref heightmargin, ref curPos, newMachine);
                                              if (_floorView._floorViewUserLocations)
                                              {
                                                  if (!(_floorView.chkSortPos.IsChecked.Value &&
                                                        _floorView.chkSortAsset.IsChecked.Value))
                                                  {
                                                      if (savedPositions == null) savedPositions = new FloorPositionDto();
                                                      savedPositions.Modify(userId, newMachine.SlotID, TypeSystem.GetValueInt(newMachine.Left), TypeSystem.GetValueInt(newMachine.Top), 0);
                                                  }
                                              }
                                        }

                                        //// save the initial positions
                                        //if (CFloorView._FirstDragPosition)
                                        //{
                                        //    if (savedPositions == null) savedPositions = new FloorPositionDto();
                                        //    savedPositions.Modify(userId, newMachine.SlotID, TypeSystem.GetValueInt(newMachine.Left), TypeSystem.GetValueInt(newMachine.Top), 0);
                                        //}

                                        this.AddSlotMachineToUI(slotPair, newMachine);
                                    }
                                }
                            }
                        }
                        catch (ThreadAbortException)
                        {
                            LogManager.WriteLog(PROC + " => Thread was instructed to close.", LogManager.enumLogLevel.Error);
                        }
                        catch (Exception ex)
                        {
                            ExceptionManager.Publish(ex);
                        }
                        finally
                        {
#if DEBUG
                            watch.Stop();
                            LogManager.WriteLog(PROC + string.Format(" => Total time taken [{0}] to load the slot machines into UI.", watch.Elapsed.ToString()), LogManager.enumLogLevel.Info);
#endif
                            if (hasPositionSaved)
                            {
                                CDOSettings.Current.Save();
                            }

                            // notify the initial positions to all the clients logged in with the current user id
                            if (savedPositions != null && savedPositions.Count > 0)
                            {
                                _floorView.NotifyFloorPosition(savedPositions);                                
                            }
                            //if (CFloorView._FirstDragPosition)
                            //{
                            //    CFloorView._FirstDragPosition = false;
                            //}
                        }
                    }));

                if (clearMachines)
                {
                    LogManager.WriteLog(PROC + " => Unable to refresh. Clear machines called instead.", LogManager.enumLogLevel.Error);
                }
            }
            catch (ThreadAbortException)
            {
                LogManager.WriteLog(PROC + " => Thread was instructed to close.", LogManager.enumLogLevel.Error);
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(PROC + " => Exception occured in function.", LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
            }
            finally
            {
#if DEBUG
                LogManager.WriteLog(PROC + " => Finished.", LogManager.enumLogLevel.Error);
#endif
            }
        }
 /// <summary>
 /// Clears the machine.
 /// </summary>
 /// <param name="machine">The machine.</param>
 private void ClearMachine(SlotMachine machine)
 {
     try
     {
         _floorView.ClearSlotMouseUpEvent(machine);
         _canvas.Children.Remove(machine);
         machine.ContextMenu = null;
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
        internal void SaveFloorPosition(SlotMachine slotMachinePosition, bool isDefault, ref bool isSaved)
        {
            if (!isDefault || chkRePosition.IsChecked.Value)
            {
                int userID = CDOSettings.Current.LoggedInUser.SecurityUserID;
                int left = TypeSystem.GetValueInt(Canvas.GetLeft(slotMachinePosition));
                int top = TypeSystem.GetValueInt(Canvas.GetTop(slotMachinePosition));

                //if (CFloorView._FirstDragPosition)
                //{
                //    _analysisBusinessObject.SaveUserBasedFloorPosition(SlotMachineCollectionFactory.ToXml(this), userID);
                //    CFloorView._FirstDragPosition = false;
                //}

                _analysisBusinessObject.SaveFloorPosition(slotMachinePosition.SlotID, userID,
                                                             top,
                                                             left);
                int currentZIndex = Canvas.GetZIndex(slotMachinePosition);

                if (_floorViewUserLocations)
                {
                    FloorPositionDataDto positionData = slotMachinePosition.PositionData;
                    FloorPositionDto position = new FloorPositionDto()
                    {
                       { 
                           new FloorPositionKeyDto(userID, slotMachinePosition.SlotID),
                           new FloorPositionDataDto(slotMachinePosition.SlotID, left, top, currentZIndex) 
                       },
                    };
                    _clientSubcriber.NotifyFloorPosition(position);
                }
            }
        }
        internal void CalculatePositionAndPaint(ref double widthmargin, ref double heightmargin, ref int curPos, SlotMachine newMachine)
        {
            var perRow = int.Parse(pnlFloor.Width.ToString()) /
                         (int.Parse(newMachine.Width.ToString()) + 10);

            if ((perRow / curPos == 1) && (perRow % curPos == 0))
            {
                Canvas.SetLeft(newMachine, widthmargin);
                Canvas.SetTop(newMachine, heightmargin);
                newMachine.Left = widthmargin;
                newMachine.Top = heightmargin;

                widthmargin = 10;
                heightmargin = heightmargin + newMachine.Height + 20;
                curPos = 0;
            }
            else
            {

                Canvas.SetLeft(newMachine, widthmargin);
                Canvas.SetTop(newMachine, heightmargin);
                newMachine.Left = widthmargin;
                newMachine.Top = heightmargin;

                widthmargin = widthmargin + newMachine.Width + 10;
            }

            curPos += 1;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.ucPosDetails = ((BMC.Presentation.PosDetails)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.pnlHeader = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.lblPercentagePayout = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.lblAsset = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.lblBaseDenom = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.lblMaxBet = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.lblCreditValue = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.lblRoute = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 10:
                this.txtRoute = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.lblSerialNo = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.lblManufacturer = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.lblActAsset = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 14:
                this.lblGMU = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:
                this.btnExit = ((System.Windows.Controls.Button)(target));

            #line 53 "..\..\..\UserControls\PosDetails.xaml"
                this.btnExit.Click += new System.Windows.RoutedEventHandler(this.btn_Exit);

            #line default
            #line hidden
                return;

            case 16:
                this.ucSlotMachine = ((BMC.Presentation.SlotMachine)(target));
                return;

            case 17:
                this.lblZoneName = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 18:
                this.rbHandpay = ((System.Windows.Controls.RadioButton)(target));

            #line 68 "..\..\..\UserControls\PosDetails.xaml"
                this.rbHandpay.Click += new System.Windows.RoutedEventHandler(this.Handpay_Click);

            #line default
            #line hidden
                return;

            case 19:
                this.rbPlayerClub = ((System.Windows.Controls.RadioButton)(target));

            #line 69 "..\..\..\UserControls\PosDetails.xaml"
                this.rbPlayerClub.Click += new System.Windows.RoutedEventHandler(this.PlayerClub_Click);

            #line default
            #line hidden
                return;

            case 20:
                this.rbFieldService = ((System.Windows.Controls.RadioButton)(target));

            #line 70 "..\..\..\UserControls\PosDetails.xaml"
                this.rbFieldService.Click += new System.Windows.RoutedEventHandler(this.FldService_Click);

            #line default
            #line hidden
                return;

            case 21:
                this.rbEvents = ((System.Windows.Controls.RadioButton)(target));

            #line 71 "..\..\..\UserControls\PosDetails.xaml"
                this.rbEvents.Click += new System.Windows.RoutedEventHandler(this.Events_Click);

            #line default
            #line hidden
                return;

            case 22:
                this.rbMachineMeters = ((System.Windows.Controls.RadioButton)(target));

            #line 73 "..\..\..\UserControls\PosDetails.xaml"
                this.rbMachineMeters.Click += new System.Windows.RoutedEventHandler(this.MCMeters_Click);

            #line default
            #line hidden
                return;

            case 23:
                this.rbCurrentMeters = ((System.Windows.Controls.RadioButton)(target));

            #line 74 "..\..\..\UserControls\PosDetails.xaml"
                this.rbCurrentMeters.Click += new System.Windows.RoutedEventHandler(this.MCCurrentMeters_Click);

            #line default
            #line hidden
                return;

            case 24:
                this.rbRemoveMachine = ((System.Windows.Controls.RadioButton)(target));

            #line 75 "..\..\..\UserControls\PosDetails.xaml"
                this.rbRemoveMachine.Click += new System.Windows.RoutedEventHandler(this.RemoveMachine_Click);

            #line default
            #line hidden
                return;

            case 25:
                this.rbMachineMaintenance = ((System.Windows.Controls.RadioButton)(target));

            #line 76 "..\..\..\UserControls\PosDetails.xaml"
                this.rbMachineMaintenance.Click += new System.Windows.RoutedEventHandler(this.rbMachineMaintenance_Click);

            #line default
            #line hidden
                return;

            case 26:
                this.rbReInstateMachine = ((System.Windows.Controls.RadioButton)(target));

            #line 77 "..\..\..\UserControls\PosDetails.xaml"
                this.rbReInstateMachine.Click += new System.Windows.RoutedEventHandler(this.rbReInstateMachine_Click);

            #line default
            #line hidden
                return;

            case 27:
                this.rbSyncTicketExpire = ((System.Windows.Controls.RadioButton)(target));

            #line 78 "..\..\..\UserControls\PosDetails.xaml"
                this.rbSyncTicketExpire.Click += new System.Windows.RoutedEventHandler(this.SyncTicketExpire_Click);

            #line default
            #line hidden
                return;

            case 28:
                this.pnlContent = ((System.Windows.Controls.Grid)(target));

            #line 83 "..\..\..\UserControls\PosDetails.xaml"
                this.pnlContent.Loaded += new System.Windows.RoutedEventHandler(this.pnlContent_Loaded);

            #line default
            #line hidden
                return;

            case 29:
                this.lblGame = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 13
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((BMC.Presentation.PositionDetailsComp)(target));
                return;

            case 2:
                this.OnLoaded1_BeginStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target));
                return;

            case 3:
                this.pnlLayoutRoot = ((System.Windows.Controls.DockPanel)(target));
                return;

            case 4:
                this.pnlHeader = ((System.Windows.Controls.Grid)(target));
                return;

            case 5:
                this.lblPosition = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.lblGame = ((System.Windows.Controls.Label)(target));
                return;

            case 7:
                this.lblAsset = ((System.Windows.Controls.Label)(target));
                return;

            case 8:
                this.btnExit = ((System.Windows.Controls.Button)(target));

            #line 38 "..\..\..\UserControls\PositionDetailsComp.xaml"
                this.btnExit.Click += new System.Windows.RoutedEventHandler(this.btn_Exit);

            #line default
            #line hidden
                return;

            case 9:
                this.ucSlotMachine = ((BMC.Presentation.SlotMachine)(target));
                return;

            case 10:
                this.pnlHandpay = ((System.Windows.Controls.Canvas)(target));
                return;

            case 11:
                this.Path_105 = ((System.Windows.Shapes.Path)(target));
                return;

            case 12:
                this.Path_106 = ((System.Windows.Shapes.Path)(target));
                return;

            case 13:
                this.Path_107 = ((System.Windows.Shapes.Path)(target));
                return;

            case 14:
                this.btnHandPayProcess = ((System.Windows.Controls.Button)(target));

            #line 68 "..\..\..\UserControls\PositionDetailsComp.xaml"
                this.btnHandPayProcess.Click += new System.Windows.RoutedEventHandler(this.btnHandPayProcess_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.Path_109 = ((System.Windows.Shapes.Path)(target));
                return;

            case 16:
                this.Path_110 = ((System.Windows.Shapes.Path)(target));
                return;

            case 17:
                this.Path_111 = ((System.Windows.Shapes.Path)(target));
                return;

            case 18:
                this.lblDate = ((System.Windows.Controls.Label)(target));
                return;

            case 19:
                this.lblTime = ((System.Windows.Controls.Label)(target));
                return;

            case 20:
                this.lblHandPayType = ((System.Windows.Controls.Label)(target));
                return;

            case 21:
                this.lblHandPayValue = ((System.Windows.Controls.Label)(target));
                return;

            case 22:
                this.pnlPlayerClub = ((System.Windows.Controls.Canvas)(target));
                return;

            case 23:
                this.Path_1 = ((System.Windows.Shapes.Path)(target));
                return;

            case 24:
                this.Path_3 = ((System.Windows.Shapes.Path)(target));
                return;

            case 25:
                this.Path_4 = ((System.Windows.Shapes.Path)(target));
                return;

            case 26:
                this.Path_5 = ((System.Windows.Shapes.Path)(target));
                return;

            case 27:
                this.Path_6 = ((System.Windows.Shapes.Path)(target));
                return;

            case 28:
                this.Path_7 = ((System.Windows.Shapes.Path)(target));
                return;

            case 29:
                this.lblPlayerName = ((System.Windows.Controls.Label)(target));
                return;

            case 30:
                this.lblPlayerAccount = ((System.Windows.Controls.Label)(target));
                return;

            case 31:
                this.lblPlayerStatus = ((System.Windows.Controls.Label)(target));
                return;

            case 32:
                this.lblPlayerTimeOfPlay = ((System.Windows.Controls.Label)(target));
                return;

            case 33:
                this.pnlActionButtons = ((System.Windows.Controls.Primitives.UniformGrid)(target));
                return;

            case 34:
                this.btnMeterLife = ((System.Windows.Controls.Button)(target));

            #line 154 "..\..\..\UserControls\PositionDetailsComp.xaml"
                this.btnMeterLife.Click += new System.Windows.RoutedEventHandler(this.btnMeterLife_Click);

            #line default
            #line hidden
                return;

            case 35:
                this.btnServiceRequest = ((System.Windows.Controls.Button)(target));

            #line 155 "..\..\..\UserControls\PositionDetailsComp.xaml"
                this.btnServiceRequest.Click += new System.Windows.RoutedEventHandler(this.btnServiceRequest_Click);

            #line default
            #line hidden
                return;

            case 36:

            #line 156 "..\..\..\UserControls\PositionDetailsComp.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 37:
                this.btnEnrol = ((System.Windows.Controls.Button)(target));

            #line 159 "..\..\..\UserControls\PositionDetailsComp.xaml"
                this.btnEnrol.Click += new System.Windows.RoutedEventHandler(this.btnEnrol_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }