Exemple #1
0
        private void saveCustomReportProps()
        {
            //Data.SetReportProps(printReport.ReportName, printReport.PrintAuto,
            //    printReport.PrintTime, printReport.PrintPeriod);
            MemIniFile mif = new MemIniFile(String.Empty);

            mif.FromString(Properties.Settings.Default.ReportsConfig);
            mif.WriteString(internalname, "ReportName", printReport.ReportName);
            mif.WriteBool(internalname, "PrintAuto", printReport.PrintAuto);
            mif.WriteDate(internalname, "PrintTime", printReport.PrintTime);
            mif.WriteInteger(internalname, "PrintPeriod", printReport.PrintPeriod);
            //mif.UpdateFile();
            Properties.Settings settings = Properties.Settings.Default;
            settings.ReportsConfig = mif.ToString();
            settings.Save();
        }
Exemple #2
0
 private void frmPanel_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (Properties.Settings.Default.WindowMode &&
         this.WindowState == FormWindowState.Normal)
     {
         Properties.Settings settings = Properties.Settings.Default;
         if (settings.PanelLeft != this.Left ||
             settings.PanelTop != this.Top ||
             settings.PanelWidth != this.Width ||
             settings.PanelHeight != this.Height)
         {
             settings.PanelLeft   = this.Left;
             settings.PanelTop    = this.Top;
             settings.PanelWidth  = this.Width;
             settings.PanelHeight = this.Height;
             settings.Save();
         }
     }
 }
Exemple #3
0
        private void PeriodicalCheck()
        {
            // подача сигнала о работоспособности клиента
            if (!backImLive.IsBusy)
            {
                backImLive.RunWorkerAsync(new object[] { ClientID, StationNumber,
                                                         Properties.Settings.Default.StationName });
            }
            // ------------------------------------------
            UpdateViewToAllPanels();
            int      dd;
            int      mm;
            int      hh;
            DateTime Now = DateTime.Now;

            dd = Now.Day;
            hh = Now.Hour;
            mm = Now.Minute;
            if (LastMinute != mm)
            {
                LastMinute = mm;
                if (LastHour != hh)
                {
                    LastHour = hh;
                    if (LastDay != dd)
                    {
                        Cursor             = Cursors.WaitCursor;
                        timerClock.Enabled = false;
                        try
                        {
                            LastDay = dd;
                            Properties.Settings settings = Properties.Settings.Default;
                            int minutes = settings.RemoveMinutes;
                            if (minutes > 0)
                            {
                                Data.DeleteFromTable(calctime(Now, minutes), "minutes");
                            }
                            int hours = settings.RemoveHours;
                            if (hours > 0)
                            {
                                Data.DeleteFromTable(calctime(Now, hours), "hours");
                            }
                            int days = settings.RemoveDays;
                            if (days > 0)
                            {
                                Data.DeleteFromTable(calctime(Now, days), "days");
                            }
                            int months = settings.RemoveMonths;
                            if (months > 0)
                            {
                                Data.DeleteFromTable(calctime(Now, months), "months");
                            }
                            int trends = settings.RemoveTrends;
                            if (trends > 0)
                            {
                                Data.DeleteFromTrends(calctime(Now, trends));
                            }
                            int logs = settings.RemoveLogs;
                            if (logs > 0)
                            {
                                Data.DeleteFromLogs(calctime(Now, logs));
                            }
                            int reports = settings.RemoveReports;
                            if (reports > 0)
                            {
                                Data.DeleteFromReports(calctime(Now, reports));
                            }
                            SendToAllPanels("Готово");
                        }
                        finally
                        {
                            timerClock.Enabled = true;
                            Cursor             = Cursors.Default;
                        }
                    }
                }
                AutoPrintReports(Now);
            }
            // Закрытие главного окна, когда все панели уже закрыты
            if (panels != null)
            {
                int panelscount = 0;
                for (int i = 0; i < panels.Length; i++)
                {
                    if (!String.IsNullOrWhiteSpace(panels[i].Text))
                    {
                        panelscount++;
                    }
                }
                if (panelscount == 0)
                {
                    Application.Exit();
                }
            }
        }
Exemple #4
0
        private void LoadGeneralSettings()
        {
            Properties.Settings settings = Properties.Settings.Default;
            tbObjectName.Text             = settings.ObjectName;
            cbStationNumber.SelectedIndex = settings.Station - 1;
            tbStationName.Text            = settings.StationName;
            cbScreenSize.SelectedIndex    = settings.ScreenSize;
            cbScreensCount.SelectedIndex  = settings.ScreensCount;
            cbSoundMode.SelectedIndex     = settings.SoundMode;
            cbSystemShell.Checked         = settings.SystemShell;
            nudDisplayTimeout.Value       = settings.DisplayTimeout;
            //----------------------------------
            cbRootScheme.Items.Clear();
            int i = 0;

            foreach (KeyValuePair <string, string> item in Data.GetSchemesList())
            {
                cbRootScheme.Items.Add(item.Key);
                if (item.Key.Equals(settings.RootScheme))
                {
                    cbRootScheme.SelectedIndex = i;
                }
                i++;
            }
            //----------------------------------
            cbWindowMode.Checked = settings.WindowMode;
            //----------------------------------
            lvFetchServers.Items.Clear();
            string loadedservers = settings.LoadedFetchServers;

            if (loadedservers.Length > 0)
            {
                string[] items = loadedservers.Split(new char[] { ';' });
                foreach (string item in items)
                {
                    string filename = Application.StartupPath + "\\" + item + ".exe";
                    if (File.Exists(filename))
                    {
                        FileVersionInfo myFileVersionInfo =
                            FileVersionInfo.GetVersionInfo(filename);
                        lvFetchServers.Items.Add(item).SubItems.
                        Add(myFileVersionInfo.Comments);
                    }
                    else
                    {
                        lvFetchServers.Items.Add(item).SubItems.Add("[не найден]");
                    }
                }
            }
            //----------------------------------
            lvRemoteCameras.Items.Clear();
            string remotecameras = settings.RemoteCameras;

            if (remotecameras.Length > 0)
            {
                string[] items = remotecameras.Split(new char[] { ';' });
                int      n     = 0;
                foreach (string item in items)
                {
                    if ((n & 0x01) > 0)
                    {
                        lvRemoteCameras.Items[lvRemoteCameras.Items.Count - 1].
                        SubItems.Add(item);
                    }
                    else
                    {
                        lvRemoteCameras.Items.Add(item);
                    }
                    n++;
                }
            }
            //----------------------------------
            cbTrends.SelectedIndex  = settings.RemoveTrends;
            cbMinutes.SelectedIndex = settings.RemoveMinutes;
            cbHours.SelectedIndex   = settings.RemoveHours;
            cbDays.SelectedIndex    = settings.RemoveDays;
            cbMonths.SelectedIndex  = settings.RemoveMonths;
            cbLogs.SelectedIndex    = settings.RemoveLogs;
            cbReports.SelectedIndex = settings.RemoveReports;
            udGroups.Value          = settings.GroupsCount;
            udTableGroups.Value     = settings.TableGroupsCount;
        }