コード例 #1
0
        private void AppForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //FormStats formStats = new FormStats(Width, Height, Location);

            var formStats = new FormStats
            {
                _Width    = this.Width,
                _Height   = this.Height,
                _Location = this.Location
            };

            File.WriteAllText(@"C:\Users\Zvone\Desktop\Lab\C# vjezbe\Lab10\formStats.json", JsonConvert.SerializeObject(formStats));
        }
コード例 #2
0
        public AppForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            FormStats formStats   = new FormStats();
            bool      jsonExsists = false;

            try
            {
                formStats   = JsonConvert.DeserializeObject <FormStats>(File.ReadAllText(@"C:\Users\Zvone\Desktop\Lab\C# vjezbe\Lab10\formStats.json"));
                jsonExsists = true;
            }
            catch (Exception)
            {
                Console.WriteLine("Problem with reading the JSON file!");
            }

            if (jsonExsists)
            {
                Width    = formStats._Width;
                Height   = formStats._Height;
                Location = formStats._Location;
            }



            APP_FORM = this;

            PERSONS_ROOT_NODE = new TreeNode("Persons");
            treeView1.Nodes.Add(PERSONS_ROOT_NODE);

            _cmdProcessor = new CommandProcessor();
            _cmdProcessor.setUnReButtonState();
        }