protected override int Execute(ActionData data)
 {
     try {
         ConfigManager   manager         = AppManager.ConfigManager;
         FileToInt32List zaehlstand      = new FileToInt32List(manager.SdCardDir, "zaehlst.txt");
         CounterSettings counterSettings = null;
         if (!zaehlstand.Empty)
         {
             AppManager.MainForm.Cursor = Cursors.WaitCursor;
             counterSettings            = new CounterSettings(zaehlstand.ParamList);
             PropertiesForm dialog = new PropertiesForm();
             dialog.Description = Resources.CounterListActionCounter; //@Language Resource
             dialog.FileInfo    = zaehlstand.FileInfo;
             BasicPropertyBag bag = new BasicPropertyBag(new object[] { counterSettings });
             dialog.SelectedObject  = bag;
             dialog.PrintProperties = PrintProperty.GetPrintProperties(bag);
             dialog.ShowDialog(AppManager.MainForm);
         }
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     finally {
         AppManager.MainForm.Cursor = Cursors.Default;
     }
     return(0);
 }
        public static String[] Read(Stream stream)
        {
            TextReader    tr = new StreamReader(stream);
            List <String> sl = new List <String>();
            int           i  = 0;

            try {
                while (true)
                {
                    String s = tr.ReadLine();
                    if (s == null)
                    {
                        break;
                    }
                    sl.Add(s);
                    i++;
                }
            }
            catch (IOException e) {
                AppExtension.PrintStackTrace(e);
            }
            finally {
                tr.Close();
            }
            return(sl.ToArray());
        }
Ejemplo n.º 3
0
 public static void SaveDocument(XmlDocument document, FileInfo file)
 {
     try {
         document.Save(file.FullName);
     }
     catch (XmlException e) {
         AppExtension.PrintStackTrace(e);
     }
 }
Ejemplo n.º 4
0
 protected override int Execute(ActionData data)
 {
     try {
         Application.Exit();
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     return(0);
 }
Ejemplo n.º 5
0
 protected override int Execute(ActionData data)
 {
     try {
         HelpManager.ShowHelp();
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     return(0);
 }
Ejemplo n.º 6
0
 protected override int Execute(ActionData data)
 {
     try {
         ConfigEditor dialog = new ConfigEditor();
         dialog.ShowDialog(AppManager.MainForm);
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     return(0);
 }
Ejemplo n.º 7
0
 protected override int Execute(ActionData data)
 {
     try {
         AppManager.ConfigManager.WriteConfig();
         AppExtension.CloseStackTrace();
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
         AppExtension.CloseStackTrace();
     }
     return(0);
 }
Ejemplo n.º 8
0
        private static XmlDocument GetDocument(FileInfo file)
        {
            XmlDocument document = new XmlDocument();

            try {
                document.Load(file.FullName);
            }
            catch (IOException ioe) {
                AppExtension.PrintStackTrace(ioe);
            }
            return(document);
        }
Ejemplo n.º 9
0
 protected override int Execute(ActionData data)
 {
     try {
         PrintingManager manager = AppManager.MainForm.ChartControl.ChartMain.Printing;
         manager.PrintDocument.DefaultPageSettings.Landscape = true;
         manager.PrintDocument.DefaultPageSettings.Margins   = new System.Drawing.Printing.Margins(39, 39, 39, 39);
         manager.Print(true);
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     return(0);
 }
Ejemplo n.º 10
0
 public void FillSolvisList(string fileName)
 {
     if (!File.Exists(fileName))
     {
         return;
     }
     try {
         AppManager.MainForm.Cursor = Cursors.WaitCursor;
         AppManager.MainForm.SetStatusLabel(string.Empty);
         RowValues.mean.Reset();
         SolvisList.Clear();
         StreamReader reader = new StreamReader(fileName, Encoding.Default);
         try {
             int lineNumber = 1;
             while (!reader.EndOfStream)
             {
                 RowValues item = new RowValues(reader.ReadLine(), lineNumber);
                 lineNumber++;
                 if (item.HasValues)
                 {
                     SolvisList.Add(item);
                 }
             }
             DateTime min = (SolvisList[0].DateAndTime);
             DateTime max = (SolvisList[SolvisList.Count - 1].DateAndTime);
             AppManager.ItemManager.ToolMenu.SetMinMaxDate(min, max);
             AppManager.MainForm.Text = AppManager.ApplicationText + rFile + Path.GetFileNameWithoutExtension(fileName);
         }
         finally {
             if (reader != null)
             {
                 reader.Close();
             }
         }
         //Serialize();
         //DeSerialize();
     }
     catch (ArgumentException ex) {
         AppManager.MainForm.Text = AppManager.ApplicationText;
         SolvisList.Clear();
         DateTime now = DateTime.Now;
         AppManager.ItemManager.ToolMenu.SetMinMaxDate(now, now);
         AppManager.ItemManager.ToolMenu.SetDayItemsDisabled();
         AppManager.MainForm.SetStatusLabel(Resources.DataManagerSolvisFileError); //@Language Resource
         AppExtension.PrintStackTrace(ex);
     }
     finally {
         AppManager.ItemManager.UpdateItems();
         AppManager.MainForm.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 11
0
 protected override int Execute(ActionData data)
 {
     try {
         AboutDialog dialog = new AboutDialog();
         dialog.Init();
         if (dialog.ShowDialog(AppManager.MainForm) == DialogResult.OK)
         {
         }
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     return(0);
 }
Ejemplo n.º 12
0
 internal static double Formula5(RowValues rowValues, SeriesState state)
 {
     if (iCalculator != null)
     {
         try {
             return(iCalculator.Formula5(rowValues, state));
         }
         catch (Exception ex) {
             AppManager.MainForm.SetStatusLabel("P10: " + Resources.CalculatorProxyRuntimeError); //@Language Resource
             AppExtension.PrintStackTrace(ex);
         }
     }
     return(0.0);
 }
Ejemplo n.º 13
0
 internal static double FormulaSolarKW(RowValues rowValues)
 {
     if (iCalculator != null && HasFormulaSolarKW)
     {
         try {
             return(iCalculator.FormulaSolarKW(rowValues));
         }
         catch (Exception ex) {
             AppManager.MainForm.SetStatusLabel("P02: " + Resources.CalculatorProxyRuntimeError); //@Language Resource
             AppExtension.PrintStackTrace(ex);
         }
     }
     return(0.0);
 }
Ejemplo n.º 14
0
 public static void WaitFor()
 {
     lock (m_lock) {
         try {
             while (IsLocked)
             {
                 //Monitor.Wait(typeof(ActionLock), 1);
                 Thread.Sleep(1); //wait(1)
             }
         }
         catch (ThreadInterruptedException ex) {
             AppExtension.PrintStackTrace(ex);
         }
     }
 }
 protected override int Execute(ActionData data)
 {
     try {
         ConfigManager   manager  = AppManager.ConfigManager;
         FileToInt32List paramact = new FileToInt32List(manager.SdCardDir, "paramact.txt");
         if (!paramact.Empty)
         {
             AppManager.MainForm.Cursor = Cursors.WaitCursor;
             HeatCircuitSettings heatCircuitSettings1 = new HeatCircuitSettings(paramact.ParamList, HeatCircuit.HC1);
             HeatCircuitSettings heatCircuitSettings2 = new HeatCircuitSettings(paramact.ParamList, HeatCircuit.HC2);
             HeatCircuitSettings heatCircuitSettings3 = new HeatCircuitSettings(paramact.ParamList, HeatCircuit.HC3);
             HeatingSettings     heatingSettings      = new HeatingSettings(paramact.ParamList);
             WaterSettings       waterSettings        = new WaterSettings(paramact.ParamList);
             CirculationSettings circulationSettings  = new CirculationSettings(paramact.ParamList);
             SolarSettings       solarSettings        = new SolarSettings(paramact.ParamList);
             SuppressMask        suppressMask         = (SuppressMask)AppManager.ConfigManager.SDCardSuppressMask;
             PropertiesForm      dialog = new PropertiesForm();
             dialog.Description = Resources.ParameterListActionParameters; //@Language Resource
             dialog.FileInfo    = paramact.FileInfo;
             List <object> objects = new List <object>();
             objects.Add(heatCircuitSettings1);
             if ((suppressMask & SuppressMask.HK2) == 0)
             {
                 objects.Add(heatCircuitSettings2);
             }
             if ((suppressMask & SuppressMask.HK3) == 0)
             {
                 objects.Add(heatCircuitSettings3);
             }
             //objects.Add(heatingSettings);
             objects.Add(waterSettings);
             objects.Add(circulationSettings);
             //objects.Add(solarSettings);
             object[]         selectedObjects = objects.ToArray();
             BasicPropertyBag bag             = new BasicPropertyBag(selectedObjects);
             dialog.SelectedObject  = bag;
             dialog.PrintProperties = PrintProperty.GetPrintProperties(bag);
             dialog.ShowDialog(AppManager.MainForm);
         }
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     finally {
         AppManager.MainForm.Cursor = Cursors.Default;
     }
     return(0);
 }
Ejemplo n.º 16
0
        private static Image LoadImage(string name)
        {
            Image image = null;

            try {
                Stream stream = GetResourceStream(name);
                if (stream != null)
                {
                    image = new Bitmap(stream);
                }
            }
            catch (ArgumentException ex) {
                AppExtension.PrintStackTrace(ex);
            }
            return(image);
        }
Ejemplo n.º 17
0
        private static Icon LoadIcon(string name)
        {
            Icon icon = null;

            try {
                Stream stream = GetResourceStream(name);
                if (stream != null)
                {
                    icon = new Icon(stream);
                }
            }
            catch (ArgumentException ex) {
                AppExtension.PrintStackTrace(ex);
            }
            return(icon);
        }
Ejemplo n.º 18
0
 public static Color GetColor(string colorRGB)
 {
     string[] values = colorRGB.Trim().Split(',');
     if (values != null && values.Length == 3)
     {
         try {
             int red   = (byte)Int32.Parse(values[0].Trim(), CultureInfo.InvariantCulture);
             int green = (byte)Int32.Parse(values[1].Trim(), CultureInfo.InvariantCulture);
             int blue  = (byte)Int32.Parse(values[2].Trim(), CultureInfo.InvariantCulture);
             return(Color.FromArgb(red, green, blue));
         }
         catch (FormatException e) {
             AppExtension.PrintStackTrace(e);
         }
     }
     return(Color.DeepPink);
 }
Ejemplo n.º 19
0
 protected override int Execute(ActionData data)
 {
     try {
         HeatCurve dialog = HeatCurve.Instance;
         if (dialog.WindowState == FormWindowState.Minimized)
         {
             dialog.WindowState = HeatCurveHelper.LastWindowState;
         }
         if (!dialog.Visible)
         {
             dialog.Show(AppManager.MainForm);
         }
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     return(0);
 }
Ejemplo n.º 20
0
        public static IList <PrintProperty> GetPrintProperties(BasicPropertyBag bag)
        {
            List <PrintProperty> result = new List <PrintProperty>();

            if (bag != null)
            {
                List <MetaProp> properties = bag.Properties;
                for (int i = 0; i < properties.Count; i++)
                {
                    try {
                        PrintProperty item = new PrintProperty(properties[i], bag);
                        result.Add(item);
                    }
                    catch (NullReferenceException ex) {
                        AppExtension.PrintStackTrace(ex);
                    }
                }
            }
            return(result);
        }
        protected override int Execute(ActionData data)
        {
            try {
                PrintingManager manager = AppManager.MainForm.ChartControl.ChartMain.Printing;
                manager.PrintDocument.DefaultPageSettings.Landscape = true;
                manager.PrintDocument.DefaultPageSettings.Margins   = new System.Drawing.Printing.Margins(39, 39, 39, 39);
                PrintPreviewDialog dialog = new PrintPreviewDialog();
                dialog.ClientSize = new Size(800, 600);
                dialog.Document   = manager.PrintDocument;
                dialog.Icon       = AppManager.IconManager.PrintPreviewIcon;

                dialog.ShowDialog(AppManager.MainForm);


                //manager.PrintPreview();
            }
            catch (Exception ex) {
                AppExtension.PrintStackTrace(ex);
            }
            return(0);
        }
Ejemplo n.º 22
0
 protected override int Execute(ActionData data)
 {
     try {
         ConfigManager manager = AppManager.ConfigManager;
         if (string.IsNullOrWhiteSpace(manager.SdCardDir))
         {
             FolderBrowserDialog folder = new FolderBrowserDialog();
             folder.Description         = ConfigEditor.FolderDescription;
             folder.ShowNewFolderButton = false;
             if (folder.ShowDialog() == DialogResult.OK)
             {
                 manager.SdCardDir = folder.SelectedPath;
             }
             else
             {
                 return(0);
             }
         }
         AppManager.MainForm.Cursor = Cursors.WaitCursor;
         FileToInt32List timeTable = new FileToInt32List(manager.SdCardDir, "zeitplan.txt");
         if (!timeTable.Empty)
         {
             TimeOverview dialog = new TimeOverview();
             dialog.TimeTable      = timeTable;
             dialog.SaveFormBitmap = manager.TimeTableBitmap;
             dialog.SuppressMask   = (SuppressMask)manager.SDCardSuppressMask;
             dialog.ShowDialog(AppManager.MainForm);
         }
     }
     catch (Exception ex) {
         AppExtension.PrintStackTrace(ex);
     }
     finally {
         AppManager.MainForm.Cursor = Cursors.Default;
     }
     return(0);
 }
Ejemplo n.º 23
0
        public bool Parse(String fileName)
        {
            try {
                FileInfo file = new FileInfo(fileName);
                if (file.Exists)
                {
                    document = GetDocument(file);
                    XmlNodeList xList = document.SelectNodes("configuration");
                    XmlNode     node0 = xList.Item(0);
                    foreach (XmlNode node1 in node0.ChildNodes)
                    {
                        switch (node1.Name)
                        {
                        case ConfigXml.ActorsTag:
                            ParseActors(node1);
                            break;

                        case ConfigXml.SensorsTag:
                            ParseSensors(node1);
                            break;

                        case ConfigXml.OptionsTag:
                            ParseOptions(node1);
                            break;

                        case ConfigXml.OpenDirTag:
                            manager.OpenDir = node1.InnerText;
                            break;

                        case ConfigXml.BurnerMinPowerTag:
                            RowValues.BurnerMinPower = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.BurnerMaxPowerTag:
                            RowValues.BurnerMaxPower = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.LatitudeTag:
                            RowValues.Latitude = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.LongitudeTag:
                            RowValues.Longitude = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.TemperatureTag:
                            ConfigManager.Temperature = XmlConvert.ToInt32(node1.InnerText);
                            break;

                        case ConfigXml.LevelTag:
                            ConfigManager.Level = XmlConvert.ToInt32(node1.InnerText);
                            break;

                        case ConfigXml.GradientTag:
                            ConfigManager.Gradient = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.TemperatureVLTag:
                            RowValues.Temperature = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.LevelFlowTag:
                            RowValues.Level = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.GradientVLTag:
                            RowValues.Gradient = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.VersionTag:
                            manager.Version = node1.InnerText;
                            break;

                        case ConfigXml.SuperUserTag:
                            manager.SuperUser = XmlConvert.ToBoolean(node1.InnerText.ToLowerInvariant());
                            break;

                        case ConfigXml.Formula1Tag:
                            manager.Formula1 = node1.InnerText;
                            break;

                        case ConfigXml.Formula2Tag:
                            manager.Formula2 = node1.InnerText;
                            break;

                        case ConfigXml.Formula3Tag:
                            manager.Formula3 = node1.InnerText;
                            break;

                        case ConfigXml.Formula4Tag:
                            manager.Formula4 = node1.InnerText;
                            break;

                        case ConfigXml.Formula5Tag:
                            manager.Formula5 = node1.InnerText;
                            break;

                        case ConfigXml.HasFormulaDllTag:
                            manager.HasFormulaDll = XmlConvert.ToBoolean(node1.InnerText.ToLowerInvariant());
                            break;

                        case ConfigXml.SolarVSGTag:
                            manager.FormulaSolarVSG = node1.InnerText;
                            break;

                        case ConfigXml.SolarKWTag:
                            manager.FormulaSolarKW = node1.InnerText;
                            break;

                        case ConfigXml.SolvisControlVersionTag:
                            RowValues.SolvisControlVersion = XmlConvert.ToInt32(node1.InnerText);
                            break;

                        case ConfigXml.SolarPulseTag:
                            RowValues.SolarPulse = XmlConvert.ToInt32(node1.InnerText);
                            break;

                        case ConfigXml.HeatCapacityTag:
                            RowValues.HeatCapacity20 = XmlConvert.ToDouble(node1.InnerText);
                            break;

                        case ConfigXml.SdCardDirTag:
                            manager.SdCardDir = node1.InnerText;
                            break;

                        case ConfigXml.TimeTableSuppressMaskTag:     //Compatibility Tag
                            manager.SDCardSuppressMask = XmlConvert.ToInt32(node1.InnerText);
                            break;

                        case ConfigXml.SDCardSuppressMaskTag:
                            manager.SDCardSuppressMask = XmlConvert.ToInt32(node1.InnerText);
                            break;

                        case ConfigXml.TimeTableBitmapTag:
                            manager.TimeTableBitmap = XmlConvert.ToBoolean(node1.InnerText.ToLowerInvariant());
                            break;

                        case ConfigXml.OneDayModeTag:
                            manager.OneDayMode = XmlConvert.ToBoolean(node1.InnerText.ToLowerInvariant());
                            break;

                        case ConfigXml.PrototypeTag:
                            manager.Prototype = XmlConvert.ToBoolean(node1.InnerText.ToLowerInvariant());
                            break;

                        default:
                            break;
                        }
                    }
                    return(true);
                }
            }
            catch (Exception e) {
                AppExtension.PrintStackTrace(e);
            }
            return(false);
        }