Esempio n. 1
0
        }         // method

        private static bool getFinReadyValue(OrderStatusEnum state)
        {
            bool confReady = WpfHelper.GetAppGlobalBool("UseReadyConfirmedState");

            return((confReady && (state == OrderStatusEnum.ReadyConfirmed)) ||
                   (!confReady && (state == OrderStatusEnum.Ready)));
        }
Esempio n. 2
0
        // размер шрифта зависит от высоты строки грида!!
        private void setWinLayout()
        {
            if (mainGrid.Width != 0.5d * Width)
            {
                mainGrid.Width = 0.5d * Width;
            }
            if (mainGrid.Height != 0.5d * Height)
            {
                mainGrid.Height = 0.5d * Height;
            }

            // title
            setTitle();
            // main message
            setMainMessage();
            // кнопки переходов
            setChangeStateButtons();

            // кнопка Закрыть
            double btnCloseFontSize = 0.3 * WpfHelper.GetRowHeightAbsValue(mainGrid, 3);

            if (btnClose.FontSize != btnCloseFontSize)
            {
                btnClose.FontSize = btnCloseFontSize;
                btnClose.Margin   = new Thickness(btnCloseFontSize, 0, btnCloseFontSize, btnCloseFontSize);
                btnClose.Padding  = new Thickness(2d * btnCloseFontSize, 0d, 2d * btnCloseFontSize, 0);
            }
        }
Esempio n. 3
0
        public static void SetColumnValue(DataGridRow row, DataGridColumn column, int columnEditorIndex, string value)
        {
            FrameworkElement contentPresenter = column.GetCellContent(row.DataContext);

            if (row.IsEditing)
            {
                List <Control> editors = new List <Control>();
                WpfHelper.FindEditableControls(contentPresenter, editors);
                if (editors.Count > columnEditorIndex)
                {
                    Control editor = editors[columnEditorIndex];
                    TextBox box    = editor as TextBox;
                    if (box != null)
                    {
                        box.Text = value;
                    }
                    ComboBox combo = editor as ComboBox;
                    if (combo != null)
                    {
                        combo.Text = value;
                    }
                    DatePicker picker = editor as DatePicker;
                    if (picker != null)
                    {
                        picker.Text = value;
                    }
                }
            }
            else
            {
                // can't set the text value if itis not being edited
                throw new Exception("Row is not being edited");
            }
        }
Esempio n. 4
0
        private void _BookmarksList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var bookmark = e.AddedItems.OfType <BookmarkViewModel>().FirstOrDefault();

            if (bookmark == null)
            {
                return;
            }

            var mainWindow = WpfHelper.FindParent <MainWindow>(this);

            if (mainWindow == null)
            {
                return;
            }

            var mainViewModel = mainWindow.DataContext as MainViewModel;

            if (mainViewModel == null)
            {
                return;
            }

            mainViewModel.Data.SelectedSheetName = bookmark.SheetName;
            var row = mainViewModel.Data.SelectedSheet[bookmark.Key];

            _DataGrid.SelectRow(row, bookmark.ColumnIndex);

            // Remove selection.
            _BookmarksList.SelectedIndex = -1;
        }
Esempio n. 5
0
        /// <summary>
        /// The OnClosing.
        /// </summary>
        /// <param name="e">The e<see cref="CancelEventArgs"/>.</param>
        protected override void OnClosing(CancelEventArgs e)
        {
            WpfHelper.SetWindowSettings(this);
            WpfHelper.SaveWindowSettings();

            base.OnClosing(e);
        }
Esempio n. 6
0
 // CONSTRUCTORS
 public OrderDishViewModel()
 {
     // из глобальных настроек
     _isUseReadyConfirmed    = (bool)WpfHelper.GetAppGlobalValue("UseReadyConfirmedState", false);
     _expTakeTS              = TimeSpan.FromSeconds(System.Convert.ToInt32(WpfHelper.GetAppGlobalValue("ExpectedTake")));
     _autoGotoReadyConfirmTS = TimeSpan.FromSeconds(System.Convert.ToInt32(WpfHelper.GetAppGlobalValue("AutoGotoReadyConfirmPeriod", 0)));
 }
Esempio n. 7
0
        static void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var doc = CodistPackage.DTE.ActiveDocument;

            if (doc == null)
            {
                return;
            }
            var docWindow = TextEditorHelper.GetActiveWpfDocumentView();

            if (docWindow == null)
            {
                return;
            }
            using (var f = new System.Windows.Forms.SaveFileDialog {
                Filter = "PNG images (*.png)|*.png",
                AddExtension = true,
                Title = "Please specify the location of the screenshot file",
                FileName = System.IO.Path.GetFileNameWithoutExtension(doc.Name) + ".png"
            }) {
                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try {
                        var g = docWindow.VisualElement.GetParent <System.Windows.Controls.Grid>();
                        WpfHelper.ScreenShot(g, f.FileName, (int)g.ActualWidth, (int)g.ActualHeight);
                    }
                    catch (Exception ex) {
                        CodistPackage.ShowErrorMessageBox("Failed to save screenshot for " + doc.Name + "\n" + ex.Message, null, true);
                    }
                }
            }
        }
Esempio n. 8
0
        // узнать, в каком состоянии находятся ВСЕ БЛЮДА заказа отображаемых на данном КДСе цехов
        public static StatusEnum GetStatusAllDishesOwnDeps(List <OrderDishViewModel> dishes)
        {
            if ((dishes == null) || (dishes.Count == 0))
            {
                return(StatusEnum.None);
            }

            int             statId       = -1;
            AppDataProvider dataProvider = (AppDataProvider)WpfHelper.GetAppGlobalValue("AppDataProvider");

            foreach (OrderDishViewModel modelDish in dishes)
            {
                if (dataProvider.Departments[modelDish.DepartmentId].IsViewOnKDS)
                {
                    if (statId == -1)
                    {
                        statId = modelDish.DishStatusId;
                    }
                    else if (statId != modelDish.DishStatusId)
                    {
                        return(StatusEnum.None);
                    }
                }
            }

            return((StatusEnum)statId);
        }
Esempio n. 9
0
 // отладочные сообщения
 // стандартные действия службы
 public static void WriteLogTraceMessage(string msg)
 {
     if ((bool)WpfHelper.GetAppGlobalValue("IsWriteTraceMessages", false) && !msg.IsNull())
     {
         _appLogger.Trace(msg);
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateWindow"/> class.
 /// </summary>
 /// <param name="verCheck">The verCheck<see cref="VersionCheck"/>.</param>
 public UpdateWindow(VersionCheck verCheck)
 {
     InitializeComponent();
     this.verCheck    = verCheck;
     this.DataContext = verCheck;
     WpfHelper.CenterChildWindow(this);
 }
Esempio n. 11
0
 public static void WriteScreenDrawDetails(string msg)
 {
     if ((bool)WpfHelper.GetAppGlobalValue("TraceScreenDrawDetails", false))
     {
         _appLogger.Trace(msg);
     }
 }
 private LeagueGeneralOptions GetLeagueGeneralOptions(GeneralOptions generalOptions)
 {
     return(new LeagueGeneralOptions
     {
         LeagueOptions = new List <LeagueOption>
         {
             //This is the sequence leagues appear in the UI
             WpfHelper.GetLeagueOption(generalOptions.InterestedInUk1, InternalLeagueCode.UK1),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInUk2, InternalLeagueCode.UK2),
             //WpfHelper.GetLeagueOption(generalOptions.InterestedInUk3, InternalLeagueCode.UK3),
             //WpfHelper.GetLeagueOption(generalOptions.InterestedInUk4, InternalLeagueCode.UK4),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInEs1, InternalLeagueCode.ES1),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInNl1, InternalLeagueCode.NL1),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInDe1, InternalLeagueCode.DE1),
             //WpfHelper.GetLeagueOption(generalOptions.InterestedInDe2, InternalLeagueCode.DE2),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInFr1, InternalLeagueCode.FR1),
             //WpfHelper.GetLeagueOption(generalOptions.InterestedInFr2, InternalLeagueCode.FR2),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInIt1, InternalLeagueCode.IT1),
             //WpfHelper.GetLeagueOption(generalOptions.InterestedInIt2, InternalLeagueCode.IT2),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInPt1, InternalLeagueCode.PT1),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInUefa1, InternalLeagueCode.UEFA1),
             WpfHelper.GetLeagueOption(generalOptions.InterestedInBr1, InternalLeagueCode.BR1),
         }
     });
 }
Esempio n. 13
0
        /// <summary>
        /// 应用程序更新
        /// </summary>
        public static void AppUpdate(bool isCloseAll = false, bool isOnlyForced = false)
        {
            var cur        = VersionHelper.Get();
            var last       = new Version(CurrentApp.Versions.No);
            var updateType = WpfHelper.GetAppUpdateType(cur, last);

            if (cur == last)
            {
                return;
            }

            if (CurrentApp.Versions.UpdateType == EnumUpdateType.Forced)
            {
                updateType = EnumUpdateType.Forced;
            }

            if (isOnlyForced && updateType != EnumUpdateType.Forced)
            {
                //仅强制更新的时候操作,非强制更新,跳出
                return;
            }

            var currentIds = GetAppProcessIds();
            var upProcess  = WpfHelper.AppUpdate(cur, CurrentApp.Application.Code, ApplicationPath, UpdateToolPath, currentIds.ToArray());

            if (isCloseAll)
            {
                Thread.Sleep(800);
                ProcessHelper.Kill(currentIds.Where(x => x != Process.GetCurrentProcess().Id).ToArray());
                Thread.Sleep(200);
                ProcessHelper.Kill(Process.GetCurrentProcess().Id);
            }
        }
Esempio n. 14
0
        // CTOR
        public DishDelimeterPanel(double width, Brush foreground, Brush background, string text)
        {
            this.Width           = width;
            this.Background      = background;
            this.BorderBrush     = Brushes.DarkBlue;
            this.BorderThickness = new Thickness(1.0d);

            double fontSize  = Convert.ToDouble(WpfHelper.GetAppGlobalValue("ordPnlDishDelimiterFontSize", 20d));
            double fontScale = Convert.ToDouble(WpfHelper.GetAppGlobalValue("AppFontScale", 1.0d));

            if (fontScale == 0d)
            {
                fontScale = 1.0d;
            }
            fontSize *= fontScale;

            TextBlock tblDelimText = new TextBlock()
            {
                TextAlignment     = TextAlignment.Center,
                Foreground        = foreground,
                VerticalAlignment = VerticalAlignment.Center,
                FontWeight        = FontWeights.Bold, FontStretch = FontStretches.Expanded,
                TextWrapping      = TextWrapping.Wrap,
                Margin            = new Thickness(0, 0, 0, 3),
                FontSize          = fontSize,
                Text = text
            };

            this.Child = tblDelimText;
        }
Esempio n. 15
0
        static void DrawTaskMark(DrawingContext dc, Brush brush, double y, string taskName)
        {
            var ft = WpfHelper.ToFormattedText(taskName, 9, Brushes.White).SetBold();

            dc.DrawRectangle(brush, EmptyPen, new Rect(0, y - ft.Height / 2, ft.Width, ft.Height));
            dc.DrawText(ft, new Point(0, y - ft.Height / 2));
        }
Esempio n. 16
0
 public static void WriteLogTraceMessage(string format, params object[] args)
 {
     if ((bool)WpfHelper.GetAppGlobalValue("IsWriteTraceMessages", false))
     {
         _appLogger.Trace(format, args);
     }
 }
Esempio n. 17
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UserControl usc = null;

            GridMain.Children.Clear();
            var item = ((ListView)sender).SelectedItem as ListViewItem;

            switch (item.Name)
            {
            case "ItemLogout":
                var wnd = WpfHelper.GetMainWindow(this);
                wnd.ShowLoginWindow();
                return;

            case "ItemUsers":
                usc = new UsersCrudWnd(LoginedUser);
                break;

            case "ItemTasks":
                usc = new TasksCrudWnd();
                break;

            default:
                break;
            }
            GridMain.Children.Add(usc);
        }
Esempio n. 18
0
 // сообщения о действиях клиента
 public static void WriteLogClientAction(string msg)
 {
     if ((bool)WpfHelper.GetAppGlobalValue("IsLogClientAction", false))
     {
         _appLogger.Trace("cltAct|" + msg);
     }
 }
Esempio n. 19
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            StatusEnum status1 = (StatusEnum)values[0]; // статус заказа из БД
            StatusEnum status2 = (StatusEnum)values[1]; // статус заказа по блюдам, разрешенным на КДСе

            Brush retVal = null;
            Dictionary <string, BrushesPair> appBrushes = BrushHelper.AppBrushes;
            string key = null;

            if (((bool)WpfHelper.GetAppGlobalValue("IsShowOrderStatusByAllShownDishes")) &&
                (status2 != StatusEnum.None) && (status2 != StatusEnum.WaitingCook) && (status2 != status1))
            {
                key = status2.ToString();
            }
            else
            {
                key = status1.ToString();
            }

            if (!key.IsNull() && appBrushes.ContainsKey(key) && (parameter != null))
            {
                string[]    aParam = parameter.ToString().Split(';');
                BrushesPair brPair = appBrushes[key];

                retVal = (aParam[0] == "fore") ? brPair.Foreground : brPair.Background;
            }

            return((retVal == null) ? _defaultBrush : retVal);
        }
Esempio n. 20
0
 public static void WriteLogClientAction(string format, params object[] paramArray)
 {
     if ((bool)WpfHelper.GetAppGlobalValue("IsLogClientAction", false))
     {
         _appLogger.Trace("cltAct|" + string.Format(format, paramArray));
     }
 }
Esempio n. 21
0
                protected override void OnVisualParentChanged(DependencyObject oldParent)
                {
                    base.OnVisualParentChanged(oldParent);
                    var p = this.GetParent <StackPanel>();

                    if (p == null)
                    {
                        goto EXIT;
                    }
                    if ((Config.Instance.DisplayOptimizations & DisplayOptimizations.CodeWindow) != 0)
                    {
                        WpfHelper.SetUITextRenderOptions(p, true);
                    }
                    if (p.Children.Count > 1)
                    {
                        OverrideDiagnosticInfo(p);
                        p.SetValue(TextBlock.FontFamilyProperty, ThemeHelper.ToolTipFont);
                        p.SetValue(TextBlock.FontSizeProperty, ThemeHelper.ToolTipFontSize);
                    }
                    if (DocElement != null || ExceptionDoc != null || ClickAndGoSymbol != null || LimitItemSize)
                    {
                        FixQuickInfo(p);
                    }
                    if (LimitItemSize)
                    {
                        ApplySizeLimit(this.GetParent <StackPanel>());
                    }
EXIT:
                    // hides the parent container from taking excessive space in the quick info window
                    this.GetParent <Border>().Collapse();
                }
Esempio n. 22
0
 public ViewModel()
 {
     if (WpfHelper.GetIsInDesignMode())
     {
         return;
     }
 }
Esempio n. 23
0
        private bool BeherrschungAccept(INode node)
        {
            var label = WpfHelper.IdToText(node.HasAttribute("label")
                ? node.GetAttribute("label")
                : node.Id);
            var regex     = new Regex(@"^.*\nV: (?<prereq>.*)$", RegexOptions.Singleline);
            var prereqStr = regex.Match(label).Groups["prereq"].Value;

            if (string.IsNullOrEmpty(prereqStr))
            {
                return(true);
            }
            var prereqs   = prereqStr.Split(',', '\n').Select(s => s.Trim()).ToList();
            var knowledge = new List <string> {
                "WI",
                "WII",
                "WIII",
                "Weltenzauber",
                "MI",
                "MII",
                "MIII",
                "BI",
                "BII",
                "Erschaffen",
                "Binden",
                "Beschwören"
            };
            var ids          = BeherrschungViewModel.CurrentWpfGraph.WpfNodes.Where(n => n.IsSelected).Select(n => n.Id.Trim());
            var finalPrereqs = RestrictOnlyKnowledge
                ? prereqs.Intersect(knowledge)
                : prereqs;

            return(!finalPrereqs.Except(ids).Any());
        }
Esempio n. 24
0
        private void Filter_SelectionChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            InvokeDelegate del = () =>
            {
                if (e.NewValue != null)
                {
                    var item = e.NewValue as RibbonGalleryItem;
                    if (sender == Filter)
                    {
                        ViewModel.AssignedToFilterSelectedItem = (string)item.Content;
                    }
                    else
                    {
                        ViewModel.ChildrenFilterSelectedItem = (string)item.Name;
                    }
                    var grid = WpfHelper.FindVisualChild <DataGrid>(this);
                    if (grid != null)
                    {
                        var workItemControl = WorkItemControl.SelectedItem;
                        if (workItemControl != null)
                        {
                            workItemControl.MoveFocus(new TraversalRequest(FocusNavigationDirection.Up));
                        }
                    }
                }
                else
                {
                    ResetFilter();
                }
            };

            Dispatcher.Invoke(del, DispatcherPriority.DataBind);
        }
Esempio n. 25
0
        /// <summary>
        /// The OnContentRendered.
        /// </summary>
        /// <param name="e">The e<see cref="EventArgs"/>.</param>
        protected override void OnContentRendered(EventArgs e)
        {
            base.OnContentRendered(e);

            if (AppSettings.Default.VersionAutoCheck)
            {
                var version = Application.Current.MainWindow.GetType()
                              .Assembly
                              .GetCustomAttribute <AssemblyInformationalVersionAttribute>()
                              .InformationalVersion;
                try
                {
                    var verCheck = new VersionCheck(version, AppSettings.Default.PackageUrl);
                    if (verCheck.DoesUpdateExist && (AppSettings.Default.IncludePrereleaseVersions || verCheck.LastestVersionIsPrerelease == false))
                    {
                        var win = new UpdateWindow(verCheck);
                        WpfHelper.SetWindowSettings(this);
                        win.ShowDialog();
                    }
                }
                catch
                {
                    // Ignore exceptions here.
                }
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Accordion top section title was resized
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnExpanderToAdd_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            Expander expander = sender as Expander;

            if (expander != null)
            {
                Grid customHeader = WpfHelper.FindDescendantElement(expander, "MyHeader") as Grid;

                if (customHeader != null)
                {
                    customHeader.Width = expander.ActualWidth - 30; // rough size of the DropDown adornment

                    double width = customHeader.Width - customHeader.ColumnDefinitions[0].ActualWidth - 8;
                    width = Math.Min(width, 144);
                    width = Math.Max(width, 0);;
                    if (width < 34)
                    {
                        // if it's to small don't show it at all
                        width = 0;
                    }

                    FrameworkElement control = WpfHelper.FindDescendantElement(customHeader, nameIdOfQuickFilter) as FrameworkElement;
                    if (control == null)
                    {
                        control = WpfHelper.FindDescendantElement(customHeader, nameIdOfStatusControl) as FrameworkElement;
                    }

                    if (control != null)
                    {
                        control.Width = width;
                    }
                }
            }
        }
Esempio n. 27
0
        public Control GetCellEditor(DataGridColumn column, DataGridRow row, RoutedEventArgs args)
        {
            FrameworkElement     contentPresenter = column.GetCellContent(row);
            Control              editor           = null;
            MouseButtonEventArgs me = args as MouseButtonEventArgs;

            if (me != null)
            {
                HitTestResult result = VisualTreeHelper.HitTest(contentPresenter, me.GetPosition(contentPresenter));
                if (result != null)
                {
                    editor = WpfHelper.FindAncestor <TextBox>(result.VisualHit);
                    if (editor == null)
                    {
                        editor = WpfHelper.FindAncestor <DatePicker>(result.VisualHit);
                        if (editor == null)
                        {
                            editor = WpfHelper.FindAncestor <ComboBox>(result.VisualHit);
                        }
                    }
                }
            }
            else
            {
                // maybe it was the TAB key or something, so we have to find the first TextBox in the new column that we can focus on.
                List <Control> editors = new List <Control>();
                WpfHelper.FindEditableControls(contentPresenter, editors);
                if (editors.Count > 0)
                {
                    editor = editors[0];
                }
            }
            return(editor);
        }
Esempio n. 28
0
        /// <summary>
        /// Accordion section was Expanded (aka selected)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnExpanderExpanded(object sender, RoutedEventArgs e)
        {
            if (currentlyExpandedExpander != null)
            {
                Expander expanderLoosing = currentlyExpandedExpander as Expander;
                expanderLoosing.IsExpanded = false;
                SetRowHeight(currentlyExpandedExpander, GridUnitType.Auto);
            }

            currentlyExpandedExpander = sender as Expander;

            SetRowHeight(sender, GridUnitType.Star);

            if (Expanded != null)
            {
                Expanded.Invoke(currentlyExpandedExpander.Content, e);
            }

            QuickFilterControl qf = WpfHelper.FindDescendantElement(currentlyExpandedExpander, nameIdOfQuickFilter) as QuickFilterControl;

            if (qf != null)
            {
                qf.Visibility = System.Windows.Visibility.Visible;
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Handles the Loaded event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var window = Window.GetWindow(this);

            if (window != null)
            {
                window.KeyDown += Window_KeyDown;
            }

            NavigationService.Navigating          += NavigationService_Navigating;
            btnPrev.Visibility                     = Visibility.Hidden;
            lblRenderStatementsProgress.Visibility = Visibility.Hidden;
            lblRenderStatementsProgress.Content    = "Progress - Creating Statements";
            pgRenderStatementsProgress.Visibility  = Visibility.Hidden;

            lblSaveMergeDocProgress.Visibility = Visibility.Collapsed;
            pgSaveMergeDocProgress.Visibility  = Visibility.Collapsed;

            WpfHelper.FadeIn(pgRenderStatementsProgress, 2000);
            WpfHelper.FadeIn(lblRenderStatementsProgress, 2000);
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += bw_DoWork;
            bw.RunWorkerCompleted += bw_RunWorkerCompleted;
            bw.RunWorkerAsync();
        }
Esempio n. 30
0
 private void RefreshCheckBoxes()
 {
     foreach (MotionControllerModel mc in TrackedControllersListBox.Items)
     {
         ListBoxItem listBoxItem = (ListBoxItem)TrackedControllersListBox.ItemContainerGenerator.ContainerFromItem(mc);
         if (listBoxItem != null)
         {
             ContentPresenter contentPresenter = WpfHelper.FindVisualChild <ContentPresenter>(listBoxItem);
             DataTemplate     dataTemplate     = contentPresenter.ContentTemplate;
             CheckBox         checkBox         = (CheckBox)dataTemplate.FindName("CheckBox", contentPresenter);
             int trackingCount = 0;
             foreach (CameraModel cameraModel in _viewModel.CamerasModel.Cameras)
             {
                 if (mc.Tracking[cameraModel])
                 {
                     trackingCount++;
                 }
             }
             if (trackingCount == _viewModel.CamerasModel.Controllers.Count)
             {
                 checkBox.IsChecked = true;
             }
             else if (trackingCount == 0)
             {
                 checkBox.IsChecked = false;
             }
             else
             {
                 checkBox.IsChecked = null;
             }
         }
     }
 }