-1

I created the json file for my WPF C# exe in the config folder. On every subsequent launch it appears in the place I last moved the window.

I want it to always appear at [367, 120].

Is this possible?

Here is my config:

{
  "title": "IssueTracker",
  "type": "exe",
  "name": "IssueTracker",
  "details": {
    "path": "C:\\evals\\glue\\IssueTracker\\IssueTracker\\bin\\Debug",
    "command": "IssueTracker.exe",
    "parameters": "",
    "top": 120,
    "left": 367,
    "width": 1000,
    "height": 400
  }
}
Mohi97
  • 29
  • 5
  • why you dont rewrite your config file before closing? – Frenchy Aug 16 '19 at 13:45
  • What has this got to do with C# or WPF? – PaulF Aug 16 '19 at 13:55
  • This is a glue configuration (https://glue42.com/). I am not able to programmatically manipulate the config file. – Mohi97 Aug 16 '19 at 13:57
  • and it is a c# wpf exe app – Mohi97 Aug 16 '19 at 13:57
  • Possible? Yes. You could handle an event ( I think sourceinitialized ) in MainWindow, read your json file and set it's top and left properties. – Andy Aug 16 '19 at 14:01
  • In a C#/WPF application you can set the starting location of the application by setting the [WindowStartupLocation](https://learn.microsoft.com/en-us/dotnet/api/system.windows.window.windowstartuplocation?view=netframework-4.8) property of the mainwindow to Manual & set the top & left property to where you want it to go. – PaulF Aug 16 '19 at 14:03
  • Thanks! But the glue engine (that the application is in) moves it after it starts – Mohi97 Aug 16 '19 at 14:05

1 Answers1

0

There is a top level property ignoreSaveOnClose, which you can set to true.

Seems it slipped from the documentation.

Here's how your config would look like:

{
  "title": "IssueTracker",
  "type": "exe",
  "name": "IssueTracker",
  "ignoreSaveOnClose": true,
  "details": {
    "path": "C:\\evals\\glue\\IssueTracker\\IssueTracker\\bin\\Debug",
    "command": "IssueTracker.exe",
    "parameters": "",
    "top": 120,
    "left": 367,
    "width": 1000,
    "height": 400
  }
}
erjitka
  • 115
  • 1
  • 9