Пример #1
0
        static public void Load(MainForm mainForm)
        {
            UiSettings uiSettings = Properties.Settings.Default.UiSettings;

            if (uiSettings != null)
            {
                mainForm.UiSettings = uiSettings;
            }

            mainForm.WcfEndpointAddress = Properties.Settings.Default.EndpointAddress;

            if (Properties.Settings.Default.ClientMode)
            {
                if (!mainForm.ClientMode)
                {
                    mainForm.ConnectToServiceOnLoad();
                }
            }
            else
            {
                TaskListStore store = Properties.Settings.Default.TaskListStore;
                switch (store)
                {
                case TaskListStore.AppConfigFile:
                    string tasksXml = Properties.Settings.Default.C1ReportsSchedulerTasks;
                    if (!string.IsNullOrEmpty(tasksXml))
                    {
                        try
                        {
                            using (MemoryStream ms = new MemoryStream(UTF8Encoding.Default.GetBytes(tasksXml)))
                                mainForm.LoadTasks(TaskListHolder.Load(ms));
                        }
                        catch (Exception ex)
                        {
                            WinUtil.ShowError(string.Format("Error loading tasks from config file: {0}", ex.Message));
                        }
                    }
                    break;

                case TaskListStore.XmlFile:
                    mainForm.FileOpen(Properties.Settings.Default.C1rsconfFileName);
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
            }
        }
Пример #2
0
 private void ShowLogForm()
 {
     if (_logForm != null)
     {
         _logForm.Visible = true;
     }
     else
     {
         _logForm = new LogForm();
         // _logForm.Owner = this;
         _logForm.FormClosing += new FormClosingEventHandler(_logForm_FormClosing);
         UiSettings uiSettings = Properties.Settings.Default.UiSettings;
         if (uiSettings != null && !uiSettings.LogFormBounds.IsEmpty)
         {
             _logForm.Bounds = uiSettings.LogFormBounds;
         }
         _logForm.Show();
     }
 }