Пример #1
0
        public BankruptcyCaseDetailUC(BankruptcyCase _BankruptcyCase, RadTabControl rtc, RadTabItem rt)
        {
            _selectedBankruptcyCase = _BankruptcyCase;
            _rtc = rtc;
            _rt  = rt;

            InitializeComponent();

            GridMain.DataContext = _selectedBankruptcyCase;
        }
        public DealerDetailUC(Dealer _dealer, RadTabControl rtc, RadTabItem rt)
        {
            InitializeComponent();

            blnLoadStates = false;

            _rtc = rtc;
            _rt  = rt;

            try
            {
                System.Net.IPHostEntry e = System.Net.Dns.GetHostEntry("www.bing.com");
            }
            catch
            {
                MainMap.Manager.Mode = AccessMode.CacheOnly;
                //MainMap.CacheLocation = "J:\\";
                MessageBox.Show("No internet connection avaible, going to CacheOnly mode.", "GMap.NET - Demo.WindowsPresentation", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            // setup zoom min/max
            sliderZoom.Maximum = MainMap.MaxZoom;
            sliderZoom.Minimum = MainMap.MinZoom;

            if (_dealer == null)
            {
                _selectedDealer = new Dealer();
                _selectedDealer.CurrentCustomer = true;
                _selectedDealer.MaxDistance     = 100;
            }
            else
            {
                _selectedDealer = _dealer;
            }

            LoadDealer();

            LoadPreviousMailings();

            // set cache mode only if no internet avaible

            // map events
            //MainMap.OnCurrentPositionChanged += new CurrentPositionChanged(MainMap_OnCurrentPositionChanged);
            //MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);
            //MainMap.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart);
            //MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);
            //MainMap.MouseMove += new System.Windows.Input.MouseEventHandler(MainMap_MouseMove);
            //MainMap.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(MainMap_MouseLeftButtonDown);
            //MainMap.Loaded += new RoutedEventHandler(MainMap_Loaded);
            //MainMap.MouseEnter += new MouseEventHandler(MainMap_MouseEnter);

            //if (_dealer.MaxDistance != null && _dealer.MaxDistance > 0.0 && _dealer.Latitude != null)
            //    AddCircleZone((double)_dealer.MaxDistance, new PointLatLng(){Lat=(double)_dealer.Latitude, Lng=(double)_dealer.Longitude});
        }
Пример #3
0
        void MouseDoubleClick1(object sender, RoutedEventArgs e)
        {
            RadTabControl tabControl = (RadTabControl)this.Parent;

            if (Type.Equals(InfoType.Chart))
            {
                Grid      grid  = Content as Grid;
                BaseChart chart = grid.ChildrenOfType <BaseChart>().FirstOrDefault();
                grid.Children.Remove(chart);
            }
        }
Пример #4
0
 private void closeTabItem(RadTabItem item)
 {
     if (item != null)
     {
         // find the parent tab control
         RadTabControl tabControl = item.Parent as RadTabControl;
         if (tabControl != null)
         {
             tabControl.Items.Remove(item);
         }
         this.tabCtrlMain.SelectedItem = tabControl.Items[1];
         // remove tabItem
     }
 }
Пример #5
0
        private void DetectLabelTypeOrDefault(RadTabControl tabControl)
        {
            if (tabControl == null)
            {
                return;
            }

            switch (tabControl.SelectedIndex)
            {
            case 0:
                _activeLabelType = OmsLabelType.Bag;

                if (_viewModel.SelectedSide != null && _viewModel.SelectedCutItem != null)
                {
                    _labelTypeMode = LabelTypeMode.CustomBagLabel;
                }
                else
                {
                    _labelTypeMode = null;
                }
                break;

            case 1:
                //if (_viewModel != null && _viewModel.IsCustomOwner)
                //{
                //    _labelService = new LabelService();
                //    //_viewModel.BoxesCustomList = _labelService.GetBoxesCustomList(_viewModel.CurrentOrderId);
                //    _labelTypeMode = null;
                //}
                _activeLabelType = OmsLabelType.Tray; break;

            case 2:
                //if (_viewModel != null && _viewModel.IsCustomOwner)
                //{
                //    _labelService = new LabelService();
                //    //_viewModel.BoxesCustomList = _labelService.GetBoxesCustomList(_viewModel.CurrentOrderId);
                //    _labelTypeMode = null;
                //}
                _activeLabelType = OmsLabelType.Box; break;

            case 4:
                _activeLabelType = OmsLabelType.Box; break;
            }
        }
Пример #6
0
        // Button Close Click - Remove the Tab - (or raise an event indicating a "CloseTab" event has occurred)
        void button_close_Click(object sender, RoutedEventArgs e)
        {
            RadTabControl tabControl = (RadTabControl)this.Parent;

            if (Type.Equals(InfoType.Chart))
            {
                Grid      grid  = Content as Grid;
                BaseChart chart = grid.ChildrenOfType <BaseChart>().FirstOrDefault();
                grid.Children.Remove(chart);
            }


            tabControl.Items.Remove(this);

            //if (tabControl.Items.Count == 1)
            //{
            //    RadTabItem item = (RadTabItem)(tabControl.Items[0]);
            //    item.IsSelected = true; // true;
            //}
        }
Пример #7
0
        private void RadButton_Save_Click(object sender, RoutedEventArgs e)
        {
            decimal       qty = 1;
            decimal       price = 0;
            int           pagid, templateid;
            string        extradesc, internaldesc;
            bool          ok  = true;
            Grid          gd  = ((RadButton)e.OriginalSource).Parent as Grid;
            RadTabControl tab = gd.Parent.FindChildByType <RadTabControl>();

            //try
            //{
            //    qty = decimal.Parse(((TextBox)gd.FindName("txtQuantity")).Text);
            //}
            //catch (Exception ex)
            //{
            //    RadWindow.Alert("Please enter a valid quantity.");
            //    ok = false;
            //}
            //try
            //{
            //    price = decimal.Parse(((TextBox)gd.FindName("txtPrice")).Text);
            //}
            //catch (Exception ex)
            //{
            //    RadWindow.Alert("Please enter a valid price.");
            //    ok = false;
            //}

            //if (ok)
            //{
            pagid        = int.Parse(((TextBlock)gd.FindName("txtPAGID")).Text);
            templateid   = int.Parse(((TextBlock)gd.FindName("txttemplateID")).Text);
            extradesc    = ((TextBox)tab.FindName("txtDesc")).Text;
            internaldesc = ((TextBox)tab.FindName("txtInternalDesc")).Text;
            //               ((NotesTemplateViewModel)LayoutRoot.DataContext).UpdateNoteTemplateItem(templateid.ToString(), pagid.ToString(), qty, price, extradesc, (App.Current as App).CurrentUserId);
            //}
        }
Пример #8
0
        private void OptionsGrid_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
        {
            if (e.Visibility == Visibility.Visible)
            {
                GridViewRow row = e.Row as GridViewRow;

                if (row != null)
                {
                    SimplePAG ed          = row.DataContext as SimplePAG;
                    decimal   retailprice = 0;

                    if (row != null && ed != null)
                    {
                        StackPanel    panel       = (StackPanel)e.DetailsElement;
                        RadTabControl rtc         = (RadTabControl)panel.FindName("tabDesc");
                        CheckBox      chksitework = (CheckBox)panel.FindName("chkSitework");

                        RadTabItem im      = (RadTabItem)rtc.FindName("tabstandarddesc");
                        TextBox    txtdesc = (TextBox)im.Content;

                        RadTabItem imadd         = (RadTabItem)rtc.FindName("tabadditionaldesc");
                        Image      addionalimage = (Image)imadd.FindName("imgAdditional");

                        if (ed.AdditionalNotes.Trim() != "")
                        {
                            addionalimage.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            addionalimage.Visibility = Visibility.Collapsed;
                        }

                        RadTabItem imextra    = (RadTabItem)rtc.FindName("tabextradesc");
                        Image      extraimage = (Image)imadd.FindName("imgExtra");

                        if (ed.ExtraDescription.Trim() != "")
                        {
                            extraimage.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            extraimage.Visibility = Visibility.Collapsed;
                        }

                        RadTabItem iminternal    = (RadTabItem)rtc.FindName("tabinternaldesc");
                        Image      internalimage = (Image)imadd.FindName("imgInternal");

                        if (ed.InternalDescription.Trim() != "")
                        {
                            internalimage.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            internalimage.Visibility = Visibility.Collapsed;
                        }

                        RadComboBox cmbcategory = (RadComboBox)panel.FindName("cmbCategory");
                        GetNonStandardAreas(cmbcategory, ed.AreaID);

                        RadComboBox cmbPriceDisplay = (RadComboBox)panel.FindName("cmbPriceDisplay");
                        cmbPriceDisplay.ItemsSource   = ((AddOptionViewModel)LayoutRoot.DataContext).EstimateNonStandardPriceDisplayCode;
                        cmbPriceDisplay.SelectedValue = ed.PriceDisplayCodeId;

                        RadComboBox cmbgroup = (RadComboBox)panel.FindName("cmbGroup");
                        GetNonStandardGroups(ed.AreaID, cmbgroup, ed.GroupID);

                        if (ed.ItemAllowToChangeDisplayCode)
                        {
                            TextBlock txtPriceDisplay = (TextBlock)panel.FindName("txtPriceDisplay");
                            txtPriceDisplay.Visibility = System.Windows.Visibility.Collapsed;
                            cmbPriceDisplay.Visibility = System.Windows.Visibility.Visible;
                        }
                        else
                        {
                            TextBlock txtPriceDisplay = (TextBlock)panel.FindName("txtPriceDisplay");
                            txtPriceDisplay.Visibility = System.Windows.Visibility.Visible;
                            cmbPriceDisplay.Visibility = System.Windows.Visibility.Collapsed;
                        }

                        if (ed.AreaName.ToUpper().Contains("NON STANDARD REQUEST"))
                        {
                            cmbcategory.IsEnabled = true;
                            cmbgroup.IsEnabled    = true;
                            if (txtdesc != null)
                            {
                                txtdesc.IsReadOnly = false;
                            }
                            chksitework.IsEnabled = true;
                        }
                        else
                        {
                            cmbcategory.IsEnabled = false;
                            chksitework.IsEnabled = false;
                            cmbgroup.IsEnabled    = false;
                        }

                        if (ed.ItemAllowToChangeDescription)
                        {
                            txtdesc.IsReadOnly = false;
                        }
                        else
                        {
                            if (txtdesc != null)
                            {
                                txtdesc.IsReadOnly = true;
                            }
                        }

                        TextBox txtPrice = (TextBox)panel.FindName("txtPrice");
                        retailprice = decimal.Parse(txtPrice.Text);
                        if (!ed.ItemAllowToChangePrice)
                        {
                            txtPrice.IsReadOnly = true;
                        }
                        else
                        {
                            txtPrice.IsReadOnly = false;
                        }

                        TextBox txtQty = (TextBox)panel.FindName("txtQuantity");
                        if (!ed.ItemAllowToChangeQuantity)
                        {
                            txtQty.IsReadOnly = true;
                        }
                        else
                        {
                            txtQty.IsReadOnly = false;
                        }

                        TextBox   txtCost = (TextBox)panel.FindName("txtCostExcGST");
                        TextBlock lblCost = (TextBlock)panel.FindName("lblcost");

                        TextBox   txtMargin = (TextBox)panel.FindName("txtMargin");
                        TextBlock lblMargin = (TextBlock)panel.FindName("lblmargin");

                        if ((App.Current as App).CurrentRoleAccessModule.AccessMarginModule && ed.ItemAllowToChangePrice)// only sales estimator can change cost
                        {
                            txtCost.IsReadOnly  = false;
                            txtMargin.IsEnabled = true;
                        }
                        else
                        {
                            txtCost.IsReadOnly  = true;
                            txtMargin.IsEnabled = false;
                        }


                        CheckBox  derivedcost    = (CheckBox)panel.FindName("chkDerivedCost");
                        TextBlock lblderivedcost = (TextBlock)panel.FindName("lblderivedcost");

                        if (((App)App.Current).CurrentRoleAccessModule.AccessMarginModule)
                        {
                            if (ed.Margin.Trim() != "" && retailprice >= 0)
                            {
                                txtMargin.Text = ed.Margin.ToString() + "%";
                            }
                            else
                            {
                                txtMargin.Text = "";
                            }

                            lblMargin.Visibility      = Visibility.Visible;
                            txtMargin.Visibility      = Visibility.Visible;
                            lblCost.Visibility        = Visibility.Visible;
                            txtCost.Visibility        = Visibility.Visible;
                            lblderivedcost.Visibility = Visibility.Visible;
                            derivedcost.Visibility    = Visibility.Visible;
                        }
                        else
                        {
                            lblMargin.Visibility      = Visibility.Collapsed;
                            txtMargin.Visibility      = Visibility.Collapsed;
                            lblCost.Visibility        = Visibility.Collapsed;
                            txtCost.Visibility        = Visibility.Collapsed;
                            lblderivedcost.Visibility = Visibility.Collapsed;
                            derivedcost.Visibility    = Visibility.Collapsed;
                        }

                        TextBox txtSubtotal = (TextBox)panel.FindName("txtSubtotal");
                        txtSubtotal.IsReadOnly = true;

                        CheckBox chkAccepted = (CheckBox)panel.FindName("chkAccepted");

                        if (!EstimateList.revisiontypepermission.ReadOnly && (App.Current as App).SelectedEstimateAllowToAcceptItem)
                        {
                            chkAccepted.IsEnabled = true;
                        }
                        else
                        {
                            chkAccepted.IsEnabled = false;
                        }
                    }
                }
            }
        }
Пример #9
0
        private void txtPathMockup_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (txtPathMockup.Text.Length > 0)
            {
                #region Get product type: men, women, mug, pillow, ...
                var folderRoot = Directory.EnumerateDirectories(txtPathMockup.Text);

                // men, women, mug, pillow
                List <string> productType = new List <string>();

                foreach (var item in folderRoot)
                {
                    string[] splitItem = item.Split("\\");
                    string   type      = FirstCharToUpper(splitItem[splitItem.Length - 1]);
                    productType.Add(type);
                }

                mockupTabControl.ItemsSource = productType;
                #endregion

                #region Get product kind: classic, hoodie, longsleeve, sweatshirt, ...
                foreach (var tabItem in mockupTabControl.ItemsSource)
                {
                    RadTabItem radTabItem = mockupTabControl.ItemContainerGenerator.ContainerFromItem(tabItem) as RadTabItem;

                    // classic, hoodie, longsleeve, sweatshirt of MEN, WOMEN
                    List <string> folderProductType = Directory.EnumerateDirectories(txtPathMockup.Text + "\\" + radTabItem.Header.ToString().ToLower()).ToList <string>();
                    List <string> shirtType         = new List <string>();

                    // 01, 02, 03, ...
                    foreach (var typeItem in folderProductType)
                    {
                        string[] splitItem = typeItem.Split("\\");
                        string   type      = FirstCharToUpper(splitItem[splitItem.Length - 1]);
                        shirtType.Add(type);
                    }

                    // if product type MEN, WOMEN
                    if (folderProductType.Count > 0)
                    {
                        RadTabControl radTabControl = new RadTabControl()
                        {
                            //ItemsSource = shirtType,
                            BorderThickness = new Thickness(0)
                        };

                        try
                        {
                            // classic, hoodie, ...
                            for (int i = 0; i < shirtType.Count; i++)
                            {
                                #region Setting listbox
                                // Setting listbox
                                ListBox listBoxImage = new ListBox()
                                {
                                    Height          = 360,
                                    BorderThickness = new Thickness(0)
                                };

                                ScrollViewer.SetHorizontalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Disabled);
                                ScrollViewer.SetVerticalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Auto);

                                // Config listbox item panel
                                FrameworkElementFactory ugTemplate = new FrameworkElementFactory(typeof(UniformGrid), "UniformGrid");
                                //ugTemplate.SetValue(UniformGrid.RowsProperty, 3);
                                ugTemplate.SetValue(UniformGrid.ColumnsProperty, 4);

                                listBoxImage.ItemsPanel = new ItemsPanelTemplate(ugTemplate);

                                // Config listbox itemTemplate
                                listBoxImage.ItemTemplate = (DataTemplate)this.Resources["TabItemTemplate"];

                                // Setting add event selection changed
                                listBoxImage.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListBoxMock_SelectionChanged);
                                #endregion

                                // Import image
                                List <Mockup> mockups = new List <Mockup>();

                                List <string> folderType = Directory.EnumerateDirectories(txtPathMockup.Text + @"\" + radTabItem.Header.ToString() + @"\" + shirtType[i]).ToList <string>();

                                List <string> fileImage = Directory.GetFiles(txtPathMockup.Text + @"\" + radTabItem.Header.ToString() + @"\" + shirtType[i], "*", SearchOption.AllDirectories).ToList <string>();

                                ScrollViewer.SetVerticalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Auto);

                                foreach (var imgFile in fileImage)
                                {
                                    string[] splitFodler = imgFile.Split("\\");
                                    string   fileName    = splitFodler[splitFodler.Length - 1].Split('.')[0];

                                    mockups.Add(new Mockup()
                                    {
                                        MockupName       = fileName,
                                        MockupSymbolPath = imgFile,
                                    });
                                }

                                listBoxImage.ItemsSource = mockups;
                                RadTabItem tempTabItem = new RadTabItem()
                                {
                                    Header  = shirtType[i],
                                    Content = listBoxImage,
                                };
                                radTabControl.Items.Add(tempTabItem);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }

                        StyleManager.SetTheme(radTabControl, new FluentTheme());
                        radTabItem.Content = radTabControl;
                    }
                    else
                    {
                        List <string> imageProduct = Directory.EnumerateFiles(txtPathMockup.Text + "\\" + radTabItem.Header.ToString().ToLower()).ToList <string>();
                        MessageBox.Show(imageProduct[0]);
                        List <Mockup> mockups = new List <Mockup>();
                        try
                        {
                            #region Setting ListBox
                            // Setting listbox
                            ListBox listBoxImage = new ListBox()
                            {
                                Height          = 396,
                                BorderThickness = new Thickness(0)
                            };

                            // Setting scroll item
                            ScrollViewer.SetHorizontalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Disabled);

                            // Config listbox item panel
                            FrameworkElementFactory ugTemplate = new FrameworkElementFactory(typeof(UniformGrid), "UniformGrid");
                            ugTemplate.SetValue(UniformGrid.RowsProperty, 3);
                            ugTemplate.SetValue(UniformGrid.ColumnsProperty, 4);

                            listBoxImage.ItemsPanel = new ItemsPanelTemplate(ugTemplate);

                            // Config listbox itemTemplate
                            listBoxImage.ItemTemplate = (DataTemplate)this.Resources["TabItemTemplate"];

                            // Setting add event selection changed
                            listBoxImage.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListBoxMock_SelectionChanged);

                            if (imageProduct.Count < 8)
                            {
                                ScrollViewer.SetVerticalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Hidden);
                            }
                            else
                            {
                                ScrollViewer.SetVerticalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Visible);
                            }
                            #endregion

                            // read file image mockup
                            foreach (var imgFile in imageProduct)
                            {
                                var designsName = System.IO.Path.GetFileName(imgFile);

                                mockups.Add(new Mockup()
                                {
                                    MockupSymbolPath = imgFile, MockupName = designsName.Split('.')[0], IsSelected = false
                                });
                            }

                            listBoxImage.ItemsSource = mockups;

                            radTabItem.Content = listBoxImage;
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    mockupTabControl.SelectedIndex = 0;
                }
                #endregion
            }
        }
		private RadCodeEditor PrepareCodeViewerForCSharpCode(RadTabControl templateContent, string codeFileText)
		{
			RadCodeEditor codeViewer;
			var tabControl = templateContent ?? templateContent.FindChildByType<RadTabControl>();
			if (tabControl == null)
			{
				throw new InvalidOperationException("CodeViewer doesn't have correct template to load.");
			}
			else
			{
				codeViewer = tabControl.ItemTemplate.LoadContent() as RadCodeEditor;
				this.PrepareSyntaxHighlighting(codeViewer, "cs");
				this.SetCodeViewerLineNumbersBackgroundToTransparent(codeViewer);
			}

			codeViewer.Document = new TextDocument(codeFileText);
			return codeViewer;
		}