示例#1
0
        public void Write(string text, Brush color)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            var textLines = text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            var p         = new Paragraph();

            for (var i = 0; i < textLines.Length - 1; i++)
            {
                p.Inlines.Add(new Run(textLines[i])
                {
                    Foreground = color
                });
                p.Inlines.Add(new LineBreak());
            }

            p.Inlines.Add(new Run(textLines.Last())
            {
                Foreground = color
            });

            Document.Blocks.Add(p);

            ViewCore.ScrollToEnd();
        }
示例#2
0
        private void Extract()
        {
            var selectedEntries = ViewCore.GetSelectedEntries();

            if (!selectedEntries.Any())
            {
                return;
            }
            var            firstName      = string.Format("{0}.{1}", selectedEntries[0].Name, selectedEntries[0].Type);
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.FileName = firstName;
            if (saveFileDialog.ShowDialog() == true)
            {
                var selectedFolder = Path.GetDirectoryName(saveFileDialog.FileName);
                foreach (var entry in selectedEntries)
                {
                    var filename = string.Format("{0}.{1}", entry.Name, entry.Type);
                    if (filename == firstName)
                    {
                        filename = Path.GetFileName(saveFileDialog.FileName);
                    }
                    var path = Path.Combine(selectedFolder, filename);
                    File.WriteAllBytes(path, entry.Data);
                }
            }
        }
示例#3
0
        private void SearchTextCore(SearchMode searchMode)
        {
            if (!string.IsNullOrEmpty(SearchText))
            {
                IEnumerable <PlaylistItem> itemsToSearch;
                if (SelectedPlaylistItem != null)
                {
                    var index = IndexOf(PlaylistManager.Items, SelectedPlaylistItem);
                    if (searchMode == SearchMode.Next)
                    {
                        index++;  // Skip the current item so that the next one will be found.
                    }
                    itemsToSearch = PlaylistManager.Items.Skip(index).Concat(PlaylistManager.Items.Take(index));
                }
                else
                {
                    itemsToSearch = PlaylistManager.Items;
                }

                if (searchMode == SearchMode.Previous)
                {
                    itemsToSearch = itemsToSearch.Reverse();
                }
                var foundItem = itemsToSearch.FirstOrDefault(x => IsContained(x.MusicFile, SearchText));
                if (foundItem != null)
                {
                    SelectedPlaylistItem = foundItem;
                    ViewCore.ScrollIntoView(foundItem);
                }
            }
            ViewCore.FocusSearchBox();
        }
示例#4
0
 private void SelectionServicePropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(SelectionService.SelectedFeed))
     {
         ViewCore.CancelMultipleSelectionMode();
         UpdateItemsListView();
     }
 }
 public void Show()
 {
     SelectedSection = Sections[0];//Client Def default
     //Login screen first
     //SelectedSection = Sections[0];
     //L/efv
     ViewCore.Show();
 }
示例#6
0
 private void OkHandler()
 {
     dialogResult = true;
     if (IsWasReturned)
     {
         SelectedPerson = null;
     }
     ViewCore.Close();
 }
示例#7
0
        public bool ShowDialog()
        {
            bool?response = ViewCore.ShowDialog();

            if (response.HasValue)
            {
                return(response.Value);
            }
            return(false);
        }
示例#8
0
        public bool ShowDialog(object parent)
        {
            bool?response = ViewCore.ShowDialog(parent);

            if (response.HasValue)
            {
                return(response.Value);
            }
            return(false);
        }
示例#9
0
 private async Task ShowWhatsNew()
 {
     await Task.Run(() =>
     {
         Common.DispatcherHelper.CheckBeginInvokeOnUI(() =>
         {
             var contentView = ChildContentViewFactory.GetChildContentViewModel(ChildViewContentType.WhatsNew);
             ViewCore.ShowChildWindow(contentView.View);
         });
     });
 }
        //public DataTable LookupTable
        //{
        //    get
        //    {
        //        return _LookupTable;
        //    }
        //    set
        //    {
        //        _LookupTable = value;
        //        OnPropertyChanged(new PropertyChangedEventArgs("LookupTable"));
        //    }
        //}

        public void ShowView()
        {
            if (ViewCore == null)
            {
                var view = _WindowService.NewParameterTableWindow();
                view.ShowView(null);
            }
            else
            {
                ViewCore.ShowView(null);
            }
        }
示例#11
0
 public void Show(bool startMinimized)
 {
     if (startMinimized)
     {
         GuiInteractionService.HideApplication();
     }
     else
     {
         ViewCore.Show();
         ShowOnLaunch();
     }
 }
示例#12
0
 public void Show(bool startMinimized)
 {
     if (startMinimized)
     {
         GuiInteractionService.HideApplication();
     }
     else
     {
         ViewCore.Show();
         Task.Run(async() => await ShowOnLaunch());
     }
 }
示例#13
0
        private void Delete()
        {
            var selectedEntries = ViewCore.GetSelectedEntries();

            if (!selectedEntries.Any())
            {
                return;
            }
            foreach (var entry in selectedEntries)
            {
                Archive.DeleteEntry(entry);
            }
            RaisePropertyChanged(nameof(Archive));
        }
示例#14
0
        private async Task Send()
        {
            try
            {
                var result = await _applicationUpdateService.SendFeedback(Name, Email, Message);

                if (result)
                {
                    ViewCore.Close();
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"FeedbackViewModel:Send: {ex}");
                _messageService.ShowWarning(Resources.SendFeedbackError);
            }
            finally
            {
                await Task.CompletedTask;
            }
        }
        private void Login(object parameter)
        {
            System.Windows.Controls.PasswordBox passwordBox = parameter as System.Windows.Controls.PasswordBox;
            string          textPassword = passwordBox.Password;
            UserResultModel userResult;

            if (Username != "" && textPassword != "")
            {
                userResult = _authenticationService.AuthenticateUser(Username, textPassword);
            }
            else
            {
                userResult = new UserResultModel()
                {
                    UserModel = null, ServerResponse = _nameOrPwdNotSpecifiedInfo
                };
            }

            if (userResult.UserModel != null)
            {
                CurrentUser.Initialize(userResult.UserModel);
            }
            ViewCore.ShowView(userResult);
        }
示例#16
0
 public void ShowBalloon()
 {
     ViewCore.ShowCustomBalloon();
 }
示例#17
0
 public void ShowBalloon(string tooltipText)
 {
     ToolTipText = tooltipText;
     DispatcherHelper.CheckBeginInvokeOnUI(() => ViewCore.ShowCustomBalloon());
 }
示例#18
0
 public void FocusItem()
 {
     ViewCore.FocusItem();
 }
示例#19
0
 public void ShowDialog(object owner)
 {
     ViewCore.ShowDialog(owner);
 }
 public void Close()
 {
     ViewCore.Close();
 }
 private void Close(bool?dialogResult)
 {
     this.dialogResult = dialogResult;
     ViewCore.Close();
 }
示例#22
0
 public void Focus()
 {
     ViewCore.FocusFirstControl();
 }
示例#23
0
 public void Quit()
 {
     ViewCore.Quit();
 }
示例#24
0
 /// <summary>
 /// </summary>
 /// <param name="tooltipText"></param>
 /// <param name="timeoutInMilliseconds"></param>
 public void ShowBalloon(string tooltipText, int timeoutInMilliseconds)
 {
     ToolTipText = tooltipText;
     DispatcherHelper.CheckBeginInvokeOnUI(() => ViewCore.ShowCustomBalloon(timeoutInMilliseconds));
 }
示例#25
0
 public void HideBalloon()
 {
     DispatcherHelper.CheckBeginInvokeOnUI(() => ViewCore.CloseBalloon());
 }
示例#26
0
        private void Confirm_OnExecute()
        {
            _dialogResult = true;

            ViewCore.Close();
        }
 public void Focus()
 {
     ViewCore.FocusFirstCell();
 }
 public bool?ShowDialog(object owner)
 {
     ViewCore.ShowDialog(owner);
     return(dialogResult);
 }
示例#29
0
 public void Show()
 {
     ViewCore.Show();
 }
示例#30
0
 protected override void FitToWidthCore()
 {
     base.FitToWidthCore();
     ViewCore.FitToWidth();
 }