Ejemplo n.º 1
0
        private void UpdateMainGuiStats()
        {
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                var leftControl  = Wpf.FindControlByName <Label>(Application.Current.MainWindow, "StatusBarLeftLabel");
                var rightControl = Wpf.FindControlByName <Label>(Application.Current.MainWindow, "StatusBarRightLabel");

                if (StatsSettings.Instance.Wins + StatsSettings.Instance.Losses == 0)
                {
                    if (StatsSettings.Instance.Concedes == 0)
                    {
                        rightControl.Content = string.Format("(No Games)");
                    }
                    else
                    {
                        rightControl.Content = string.Format("[{0} concedes]", StatsSettings.Instance.Concedes);
                    }
                }
                else
                {
                    rightControl.Content = string.Format("{0} / {1} ({2:0.00} %) [{3} concedes]",
                                                         StatsSettings.Instance.Wins,
                                                         StatsSettings.Instance.Wins + StatsSettings.Instance.Losses,
                                                         100.0f * (float)StatsSettings.Instance.Wins /
                                                         (float)(StatsSettings.Instance.Wins + StatsSettings.Instance.Losses),
                                                         StatsSettings.Instance.Concedes);

                    Log.InfoFormat("[Stats] Summary: {0}", rightControl.Content);
                }

                // Force a save all.
                Configuration.Instance.SaveAll();
            }));
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Selects the <paramref name="tab"/> and navigates to it correctly if and only if it is not already selected
		/// </summary>
		/// <param name="tab">The tab you want to select</param>
		private void SelectTab(Wpf.Controls.TabItem tab) {
			//tab.ShellObject = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, tab.ShellObject.PIDL);
			if (tab != null && !tab.ShellObject.Equals(this._ShellListView.CurrentFolder) || tab.ShellObject.IsSearchFolder) {
				tcMain.isGoingBackOrForward = true;
				NavigationController(tab.ShellObject);
				var selectedItem = tab; //TODO: Find out if we can replace [selectedItem] with [tab]
				selectedItem.Header = tab.ShellObject.DisplayName;
				selectedItem.Icon = tab.ShellObject.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);
				selectedItem.ShellObject = tab.ShellObject;
				//if (selectedItem != null) {
				var selectedPaths = selectedItem?.SelectedItems;
				if (selectedPaths != null && selectedPaths.Any()) {
					foreach (var path in selectedPaths) {
						var sho = this._ShellListView.Items.FirstOrDefault(w => w.ParsingName == path);
						if (sho != null && sho.Equals(this._ShellListView.Items[sho.ItemIndex])) {
							this._ShellListView.SelectItemByIndex(sho.ItemIndex, true);
							selectedPaths.Remove(path);
						}
					}
				}
				else {
					//this._ShellListView.ScrollToTop();
				}
				//}
			}
		}
Ejemplo n.º 3
0
 private void TritonHsOnOnGuiTick(object sender, GuiTickEventArgs guiTickEventArgs)
 {
     // Only update if we're actually enabled.
     if (IsEnabled)
     {
         Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             var leftControl     = Wpf.FindControlByName <Label>(Application.Current.MainWindow, "StatusBarLeftLabel");
             leftControl.Content = string.Format("运行时间: {0}", TritonHs.Runtime.Elapsed.ToString("h'小时 'm'分 's'秒'"));
         }));
     }
 }
Ejemplo n.º 4
0
 private void InitLeapControlButtons()
 {
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonFire);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTopRight);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTop);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTopLeft);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonCenterRight);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonCenter);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonCenterLeft);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDownRight);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDown);
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDownLeft);
 }
Ejemplo n.º 5
0
            public TheRunApplicationMethod()
            {
                _applicationLauncher = new Mock<IApplicationLauncher>();
                _viewLocator = new Mock<IViewLocator>();
                _xamlLoader = new Mock<IXamlLoader>();
                _threadManager = new Mock<IThreadManager>();

                _wpf = new Wpf(
                    _applicationLauncher.Object,
                    _viewLocator.Object,
                    _xamlLoader.Object,
                    _threadManager.Object);
            }
Ejemplo n.º 6
0
 public string ToMarkdown()
 {
     return(new MarkdownBuilder()
            .AddHeader("Windows Template Studio", Year, Month)
            .AddTable("Category", "Type", Platform)
            .AddSectionTitle("Project Generation by category")
            .AddCollapsible("Uwp Project Generation", Uwp.ToMarkdown())
            .AddCollapsible("Wpf Project Generation", Wpf.ToMarkdown())
            .AddCollapsible("WinUI Project Generation", WinUI.ToMarkdown())
            .AddTable("Windows Template Studio entry point", "Entry point", entryPoint)
            .AddTable("Programming languages", "Languages", Language)
            .GetText());
 }
Ejemplo n.º 7
0
        private void tabControl_TabItemClosing(object sender, Wpf.Controls.TabItemCancelEventArgs e)
        {
            PopUpWindowTab tab = e.TabItem.DataContext as PopUpWindowTab;
            if (null != tab)
            {
                FrameworkElement p = tab.Content as FrameworkElement;
                if(null!=p)
                {
                    Model.TabClose.Execute(p.DataContext);
                }
            }

            if (tabControl.Items.Count == 1)
                this.Close();
        }
Ejemplo n.º 8
0
 private void TritonHsOnOnGuiTick(object sender, GuiTickEventArgs guiTickEventArgs)
 {
     // Only update if we're actually enabled.
     if (IsEnabled)
     {
         Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             var leftControl     = Wpf.FindControlByName <Label>(Application.Current.MainWindow, "StatusBarLeftLabel");
             leftControl.Content = string.Format("Runtime: {0}", TritonHs.Runtime.Elapsed.ToString("h'h 'm'm 's's'"));
         }));
         if (!_isNewgameing && _isStartingNewGame)
         {
             _numStartingNewGame++;
             if (_numStartingNewGame >= 75)
             {
                 Log.DebugFormat("StartingNewGame is hang 50s , so Unlock this Hero");
                 _numStartingNewGame = 0;
                 _isUnlocking        = true;
                 UnlockHeroConf();
             }
         }
         if (_tickstop)
         {
             Log.InfoFormat("The stats plugin is stop, Ticktime not update");
         }
         else
         {
             if (_numtick >= 60)
             {
                 DateTime baseTime = Convert.ToDateTime("1970-1-1 8:00:00");
                 TimeSpan ts       = DateTime.Now - baseTime;
                 long     intervel = (long)ts.TotalSeconds;
                 StatsSettings.Instance.Ticktime = intervel;
                 _numtick = 0;
                 UpdateMainGuiStats();
             }
             else
             {
                 _numtick++;
             }
         }
     }
 }
Ejemplo n.º 9
0
        private void Initialize(Window win)
        {
            if (win == null)
            {
                throw new ArgumentNullException(nameof(win));
            }
            if (_initialized)
            {
                return;
            }

            foreach (var vm in _vms)
            {
                var template = Wpf.CreateDataTemplate(vm.GetType(), vm.ViewType);
                win.Resources.Add(template.DataTemplateKey, template);
                NavbarVm.Buttons.Add(new MenuAction(new CommandHandler(Navigate), vm.Icon, vm, vm.Name));
            }

            Content = NavbarVm.Buttons.First().CommandParameter;

            _initialized = true;
        }
Ejemplo n.º 10
0
        private void DisplayMovementsInChart(MoveDirection moveDirection, bool fire)
        {
            InitLeapControlButtons();
            switch (moveDirection.CombinedXy)
            {
            // UP
            case HandMoveDirection.UpLeftFar:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTopLeft, Wpf.LegoButtonStyle.leapFar);
                break;

            case HandMoveDirection.UpLeft:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTopLeft, Wpf.LegoButtonStyle.leap);
                break;

            case HandMoveDirection.UpFar:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTop, Wpf.LegoButtonStyle.leapFar);
                break;

            case HandMoveDirection.Up:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTop, Wpf.LegoButtonStyle.leap);
                break;

            case HandMoveDirection.UpRightFar:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTopRight, Wpf.LegoButtonStyle.leapFar);
                break;

            case HandMoveDirection.UpRight:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonTopRight, Wpf.LegoButtonStyle.leap);
                break;

            // CENTER
            case HandMoveDirection.LeftFar:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonCenterLeft, Wpf.LegoButtonStyle.leapFar);
                break;

            case HandMoveDirection.Left:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonCenterLeft, Wpf.LegoButtonStyle.leap);
                break;

            case HandMoveDirection.Center:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonCenter, Wpf.LegoButtonStyle.leap);
                break;

            case HandMoveDirection.RightFar:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonCenterRight, Wpf.LegoButtonStyle.leapFar);
                break;

            case HandMoveDirection.Right:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonCenterRight, Wpf.LegoButtonStyle.leap);
                break;

            // DOWN
            case HandMoveDirection.DownLeftFar:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDownLeft, Wpf.LegoButtonStyle.leapFar);
                break;

            case HandMoveDirection.DownLeft:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDownLeft, Wpf.LegoButtonStyle.leap);
                break;

            case HandMoveDirection.DownFar:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDown, Wpf.LegoButtonStyle.leapFar);
                break;

            case HandMoveDirection.Down:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDown, Wpf.LegoButtonStyle.leap);
                break;

            case HandMoveDirection.DownRightFar:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDownRight, Wpf.LegoButtonStyle.leapFar);
                break;

            case HandMoveDirection.DownRight:
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonDownRight, Wpf.LegoButtonStyle.leap);
                break;
            }
            if (fire)
            {
                Wpf.ChangeButtonStyleBasedOnMouseInteraction(ButtonFire, Wpf.LegoButtonStyle.leap);
            }
        }
Ejemplo n.º 11
0
 private void LeapControlButtonOnMouseLeave(object sender, MouseEventArgs e)
 {
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(sender);
 }
Ejemplo n.º 12
0
 private void ClickHandler(Wpf.Controls.TabControl.Section s)
 {
     if (SectionSelected != s)
         SectionSelected = s;
 }
Ejemplo n.º 13
0
    void tcMain_PreviewSelectionChanged(object sender, Wpf.Controls.PreviewSelectionChangedEventArgs e) {
      //if (tcMain.IsInTabDragDrop) {
      //	e.Cancel = true;
      //	return;
      //}

      //if (e.RemovedItems.Count > 0) {
      //	var tab = e.RemovedItems[0] as Wpf.Controls.TabItem;

      //	if (tab != null && this._ShellListView.GetSelectedCount() > 0) {
      //		tab.SelectedItems = this._ShellListView.SelectedItems.Select(s => s.ParsingName).ToList();
      //	}
      //}

      //if (e.AddedItems.Count == 0 || tcMain.SelectNewTabOnCreate == false) return;
      //tcMain.IsInTabDragDrop = true;
      //var newTab = e.AddedItems[0] as Wpf.Controls.TabItem;
      //if (this._ShellListView.CurrentFolder == null || !this._ShellListView.CurrentFolder.Equals(newTab.ShellObject) && tcMain.CurrentTabItem == null) {
      //	SelectTab(newTab);
      //} else if (!tcMain.IsSelectionHandled) {
      //	SelectTab(newTab);
      //	//btnUndoClose
      //	btnUndoClose.Items.Clear();
      //	foreach (var item in tcMain.ReopenableTabs) {
      //		btnUndoClose.Items.Add(item.CurrentLocation);
      //	}
      //}
      ////else if (e.RemovedItems.Count == 0) {
      ////	e.Cancel = true;
      ////	SelectTab(newTab);
      ////	tcMain.SelectedItem = e.AddedItems[0];
      ////} else if (e.RemovedItems[0] == tcMain.CurrentTabItem) {
      ////	e.Cancel = true;
      ////	tcMain.IsSelectionHandled = false;
      ////	tcMain.SelectedItem = e.RemovedItems[0];
      ////	tcMain.CurrentTabItem = null;
      ////}

      //tcMain.IsSelectionHandled = true;
      //this._ShellListView.Focus();
      //this._CurrentlySelectedItem = tcMain.SelectedItem as Wpf.Controls.TabItem;
    }
Ejemplo n.º 14
0
 private void LegoControlButtonOnMouseEnter(object sender, MouseEventArgs e)
 {
     Wpf.ChangeButtonStyleBasedOnMouseInteraction(sender, Wpf.LegoButtonStyle.hover);
 }
Ejemplo n.º 15
0
 private static IEnumerable<CameraData> ConvertCameraData(Wpf.ViewModels.Watch3D.CameraData data)
 {
     return new[]
     {
         new CameraData
         {
             Name = data.Name,
             EyeX = data.EyePosition.X,
             EyeY = data.EyePosition.Y,
             EyeZ = data.EyePosition.Z,
             LookX = data.LookDirection.X,
             LookY = data.LookDirection.Y,
             LookZ = data.LookDirection.Z,
             UpX = data.UpDirection.X,
             UpY = data.UpDirection.Y,
             UpZ = data.UpDirection.Z
         }
     };
 }