Exemple #1
0
        private void SaveAll()
        {
            foreach (var curTab in XamlTabs)
            {
                if ((curTab.Status & TabStatus.NoSave) != TabStatus.NoSave)
                {
                    continue;
                }

                if (!File.Exists(curTab.FileName))
                {
                    if (string.IsNullOrEmpty(XVCommon.ShowSaveFileDialog(curTab.FileName)))
                    {
                        continue;
                    }
                }

                if (!curTab.IsSelected)
                {
                    curTab.SaveToFile();
                    continue;
                }

                curTab.Save();
            }
        }
Exemple #2
0
        private void MouseWheel(MouseWheelEventArgs e)
        {
            var comboBox = e.Source as ComboBox;

            if (comboBox != null && comboBox.IsDropDownOpen)
            {
                return;
            }

            var listBox = e.Source as ListBox;

            if (listBox != null)
            {
                var svChild = Common.FindVisualChild <ScrollViewer>(listBox);
                if (svChild != null && DoubleUtil.GreaterThan(svChild.ScrollableHeight, 0))
                {
                    return;
                }
            }

            var sv = e.Source as ScrollViewer;

            if (sv == null)
            {
                sv = Common.FindLogicParent <ScrollViewer>(e.Source as DependencyObject);
                if (sv == null)
                {
                    return;
                }
            }

            if (e.Delta > 0)
            {
                sv.ScrollToHorizontalOffset(Math.Max(0, sv.HorizontalOffset - e.Delta));
            }
            else
            {
                sv.ScrollToHorizontalOffset(Math.Min(sv.ScrollableWidth, sv.HorizontalOffset - e.Delta));
            }

            e.Handled = true;
        }
Exemple #3
0
        private void CloseXamlTab(TabViewModel tab, bool ignoreSaving = false)
        {
            if (!ignoreSaving && (tab.Status & TabStatus.Inner) != TabStatus.Inner)
            {
                if (!FileHelper.Exists(tab.FileName))
                {
                    _dialogService.ShowMessage(string.Format("Save file \"{0}\"?", tab.FileName), MessageButton.YesNo, MessageType.Question, r =>
                    {
                        if (r.Result == ButtonResult.Yes)
                        {
                            var fileName = XVCommon.ShowSaveFileDialog(tab.FileName);
                            if (!string.IsNullOrEmpty(fileName))
                            {
                                tab.UpdateFileName(fileName);
                                tab.SaveToFile();
                            }
                        }
                    });
                }
                else
                {
                    if ((tab.Status & TabStatus.NoSave) == TabStatus.NoSave)
                    {
                        _dialogService.ShowMessage(string.Format("Save file \"{0}\"?", Path.GetFileName(tab.FileName)), MessageButton.YesNo, MessageType.Question, r =>
                        {
                            if (r.Result == ButtonResult.Yes)
                            {
                                tab.SaveToFile();
                            }
                        });
                    }
                }
            }

            Remove(tab);
        }
Exemple #4
0
 private void ApplyEditorConfig()
 {
     _eventAggregator.GetEvent <SettingChangedEvent>().Publish(UCommon.GetCurrentSettings(_appData.Config));
 }