Exemple #1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            mGridMain = GetTemplateChild(PART_GridMain) as Grid;
            if (mGridMain != null)
            {
            }
            mDragPanel = GetTemplateChild(PART_Panel) as DragPanel;
            if (mDragPanel != null)
            {
                if (PanelWidth > 0)
                {
                    mDragPanel.Width = PanelWidth;
                }
                if (PanelHeight > 0)
                {
                    mDragPanel.Height = PanelHeight;
                }
            }
            if (mGridMain != null && mDragPanel != null)
            {
                mDragHelper.Init(mGridMain, mDragPanel);
            }
        }
Exemple #2
0
 private void MyWindow_OnLoaded(object sender, RoutedEventArgs e)
 {
     mDragHelper.Init(GridContainer, UCDragPanel);
 }
Exemple #3
0
        private void Init()
        {
            try
            {
                mDragHelper.Init(GridCurrentSeat, PanelCurrentSeat);
                mViewerScale = 1.0;
                if (RegionItem == null)
                {
                    return;
                }
                mRegionInfo = RegionItem.Data as RegionInfo;
                if (mRegionInfo == null)
                {
                    return;
                }
                TxtRegionName.Text = mRegionInfo.Name;
                if (mRegionInfo.Width > 0)
                {
                    BorderRegionMap.Width = mRegionInfo.Width;
                }
                if (mRegionInfo.Height > 0)
                {
                    BorderRegionMap.Height = mRegionInfo.Height;
                }
                if (!string.IsNullOrEmpty(mRegionInfo.BgColor))
                {
                    try
                    {
                        string strColor = mRegionInfo.BgColor;
                        if (strColor.StartsWith("#"))
                        {
                            strColor = strColor.Substring(1);
                        }
                        if (strColor.Length == 8)
                        {
                            strColor = strColor.Substring(2);
                        }
                        BorderRegionMap.Background = new SolidColorBrush(Utils.GetColorFromRgbString(strColor));
                    }
                    catch { }
                }
                if (!string.IsNullOrEmpty(mRegionInfo.BgImage))
                {
                    try
                    {
                        string strFileName = mRegionInfo.BgImage;
                        string strUrl      = string.Format("{0}://{1}:{2}/{3}/UMPS4412/{4}",
                                                           CurrentApp.Session.AppServerInfo.Protocol,
                                                           CurrentApp.Session.AppServerInfo.Address,
                                                           CurrentApp.Session.AppServerInfo.Port,
                                                           ConstValue.TEMP_DIR_UPLOADFILES,
                                                           strFileName);
                        ImageBrush img = new ImageBrush(new BitmapImage(new Uri(strUrl, UriKind.Absolute)));
                        BorderRegionMap.Background = img;
                    }
                    catch { }
                }

                InitToolBtnItems();
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (s, de) =>
                {
                    LoadAllSeatInfos();
                    LoadRegionSeatInfo();
                };
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();

                    CreateToolBtnItems();
                    InitRegion();
                    CreateSeatItem();

                    ChangeLanguage();
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Exemple #4
0
 private void DragDemo_OnLoaded(object sender, RoutedEventArgs e)
 {
     mDragHelper.Init(GridMain, MyDragElement);
 }