예제 #1
0
        public void Serialize(DialogBase sourceDialog)
        {
            string className = sourceDialog.GetType().Name;
            string windowPos = sourceDialog.WindowState.ToString() + "," + sourceDialog.Top + "," + sourceDialog.Left + "," + sourceDialog.Width + "," + sourceDialog.Height;

            WindowPositions[className] = windowPos;
        }
예제 #2
0
        public void Unserialize(DialogBase targetDialog)
        {
            string className = targetDialog.GetType().Name;
            string windowPos = null;

            if (WindowPositions.TryGetValue(className, out windowPos))
            {
                string[] values = windowPos.Split(',');

                targetDialog.WindowState           = (WindowState)Enum.Parse(typeof(WindowState), values[0]);
                targetDialog.WindowStartupLocation = WindowStartupLocation.Manual;
                targetDialog.Top    = double.Parse(values[1]);
                targetDialog.Left   = double.Parse(values[2]);
                targetDialog.Width  = double.Parse(values[3]);
                targetDialog.Height = double.Parse(values[4]);
            }
        }