Esempio n. 1
0
        /// <summary>
        /// Implement Command that Load the templates list
        /// </summary>
        void ExecuteReloadTemplatesCommand(object parameter)
        {
            //if (_SelectedTag != null && _SelectedTemplateFile != null)
            //{
            //    return true;
            //}
            //else
            //{
            //    return _SelectedApplication != null &&
            //           _SelectedSnapshot != null &&
            //           _SelectedTemplateFile != null;
            //}
            if (SelectedTab == 0)
            {
                SelectedCategory      = null;
                _SelectedCategory     = null;
                _SelectedTemplateFile = null;
                SelectedTemplateFile  = null;
                TemplateFiles         = SettingsBLL.GetTemplateFileList();
            }
            else
            if (SelectedTab == 1)
            {
                SelectedApplication  = null;
                SelectedSnapshot     = null;
                _SelectedApplication = null;
                _SelectedSnapshot    = null;


                TemplateFiles = SettingsBLL.GetTemplateFileListPortfolio();
            }
        }
Esempio n. 2
0
 public SystemStateViewModel(Dispatcher dispatcher)
 {
     Dispatcher           = dispatcher;
     LiveTrains           = new ObservableCollection <LiveTrainViewModel>();
     m_DoubleClickCommand = new CommandHandler(__RowDoubleClick, true);
     m_SettingsBll        = new SettingsBLL();
 }
        private void ChangeTheme()
        {
            Status = "";

            try
            {
                var settings = new SettingsBLL(resourceContextForCurrentView);
                var theme    = settings.GetTheme();

                if (theme == "Dark")
                {
                    AppShell.Current.RequestedTheme = ElementTheme.Light;
                    settings.SaveTheme("Light");
                }
                else
                {
                    AppShell.Current.RequestedTheme = ElementTheme.Dark;
                    settings.SaveTheme("Dark");
                }
            }
            catch (Exception ex)
            {
                Status = ex.Message;
            }
        }
Esempio n. 4
0
        public MainViewModel()
        {
            m_NewCommand                      = new CommandHandler <string>(__New, true);
            m_OpenCommand                     = new CommandHandler(__Open, true);
            m_SaveCommand                     = new CommandHandler(__Save, false);
            m_SaveAsCommand                   = new CommandHandler(__SaveAs, false);
            m_SettingsCommand                 = new CommandHandler(__Settings, true);
            m_EstwOnlineCommand               = new CommandHandler(__StartEstwOnline, true);
            m_ExitCommand                     = new CommandHandler(__Exit, true);
            m_EstwSelectionCommand            = new CommandHandler(__ShowEstwSelectionWindow, false);
            m_TrainProgressInformationCommand = new CommandHandler(__ShowTrainProgressInformationWindow, false);
            m_TimeTableCommand                = new CommandHandler <Station>(__ShowTimeTableWindow, true);
            m_TrainScheduleCommand            = new CommandHandler(__ShowTrainScheduleWindow, false);
            m_SystemStateCommand              = new CommandHandler(__ShowSystemStateWindow, false);
            m_SaveLayoutCommand               = new CommandHandler(__SaveLayout, true);
            m_ClearChildWindowsCommand        = new CommandHandler(__ClearChildWindows, true);
            m_ShowHelpCommand                 = new CommandHandler(__ShowHelp, true);
            m_ShowQuickStartHelpCommand       = new CommandHandler(__ShowQuickStartHelp, true);
            m_AboutCommand                    = new CommandHandler(__ShowAboutWindow, true);
            m_DebugModeCommand                = new CommandHandler(__ToggleDebugMode, true);

            m_InitializationBll = new InitializationBLL();
            m_LiveDataBll       = new LiveDataBLL();
            m_SettingsBll       = new SettingsBLL();
            m_SerializationBll  = new SerializationBLL();

            m_ChildViewModels = new List <ViewModelBase>();
            ChildWindows      = new ObservableCollection <ChildWindow>();

            Runtime.VisibleStationsChanged += __VisibleStationsChanged;

            var AreaResult = m_InitializationBll.GetAreaInformation();

            if (AreaResult.Succeeded)
            {
                Areas = AreaResult.Result.ToObservableCollection();
            }
            else
            {
                ShowMessage(AreaResult);
                Areas = new ObservableCollection <Area>();
            }

            var SettingsResult = m_SettingsBll.AreSettingsComplete();

            if (SettingsResult.Succeeded)
            {
                if (!SettingsResult.Result)
                {
                    __Settings();
                }
            }
            else
            {
                ShowMessage(SettingsResult);
            }

            StatusBarText = "Herzlich willkommen!";
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="connection"></param>
        public void ActiveCurrentWebService(WSConnection connection)
        {
            StatesEnum state;

            Setting = SettingsBLL.AddConnection(connection, true, out state);

            MessageManager.OnServiceAdded(connection.Uri == null ? string.Empty : connection.Uri.ToString(), state);
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        private void GenerateReport()
        {
            string tmpReportFile      = string.Empty;
            string tmpReportFileFlexi = string.Empty;

            try
            {
                //Create temporary report
                string workDirectory = SettingsBLL.GetApplicationPath();
                tmpReportFile = PathUtil.CreateTempCopy(workDirectory, SelectedTemplateFile.FullName);
                if (tmpReportFile.Contains(".xlsx"))
                {
                    tmpReportFileFlexi = PathUtil.CreateTempCopyFlexi(workDirectory, SelectedTemplateFile.FullName);
                }
                //Build report
                ReportData reportData = new ReportData()
                {
                    FileName         = tmpReportFile,
                    Application      = SelectedApplication.Application,
                    CurrentSnapshot  = SelectedSnapshot,
                    PreviousSnapshot = PreviousSnapshot,
                    Parameter        = Setting.ReportingParameter,
                    RuleExplorer     = new RuleBLL(ActiveConnection),
                    SnapshotExplorer = new SnapshotBLL(ActiveConnection, SelectedSnapshot),
                    CurrencySymbol   = "$"
                };



                using (IDocumentBuilder docBuilder = BuilderFactory.CreateBuilder(reportData, tmpReportFileFlexi))
                {
                    docBuilder.BuildDocument();
                }


                if (tmpReportFile.Contains(".xlsx"))
                {
                    tmpReportFile = tmpReportFileFlexi;
                }

                //Copy report file to the selected destination
                File.Copy(tmpReportFile, ReportFileName, true);
            }
            catch (Exception)
            {
                ReportFileName = string.Empty;

                throw;
            }
            finally
            {
                if (!string.IsNullOrEmpty(tmpReportFile))
                {
                    File.Delete(tmpReportFile);
                }
            }
        }
        public SettingsViewModel()
        {
            BLL = new SettingsBLL(resourceContextForCurrentView);

            Languages = new List <String>()
            {
                "en-US", "hr-HR"
            };
        }
Esempio n. 8
0
        private void CheckLanguageSettings()
        {
            var BLL      = new SettingsBLL();
            var settings = BLL.GetLanguage();

            if (settings != null)
            {
                ApplicationLanguages.PrimaryLanguageOverride = settings;
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Implement Command that Load the templates list
 /// </summary>
 void ExecuteLoadTemplatesCommand(object parameter)
 {
     if (SelectedTab == 0)
     {
         TemplateFiles = SettingsBLL.GetTemplateFileList();
     }
     else
     if (SelectedTab == 1)
     {
         TemplateFiles = SettingsBLL.GetTemplateFileListPortfolio();
     }
 }
Esempio n. 10
0
        /// <summary>
        /// Implement remove service Command
        /// </summary>
        private void ExecuteRemoveCommand(object prameter)
        {
            if (SelectedWSConnection != null)
            {
                string tmpUrl = SelectedWSConnection.Url;

                Setting       = SettingsBLL.RemoveConnection(SelectedWSConnection);
                WSConnections = new ObservableCollection <WSConnection>(Setting.WSConnections);

                base.MessageManager.OnServiceRemoved(tmpUrl);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Implement active service Command
        /// </summary>
        private void ExecuteActiveCommand(object prameter)
        {
            if (SelectedWSConnection != null)
            {
                Setting.ChangeActiveConnection(SelectedWSConnection.Url);

                SettingsBLL.SaveSetting(Setting);

                base.MessageManager.OnServiceActivated(SelectedWSConnection.Url);

                WSConnections = new ObservableCollection <WSConnection>(Setting.WSConnections);
            }
        }
Esempio n. 12
0
        public TrainProgressInformationViewModel(Dispatcher Dispatcher)
        {
            this.Dispatcher = Dispatcher;
            Trains          = new ObservableCollection <TrainStationViewModel>();
            m_SettingsBll   = new SettingsBLL();

            m_DoubleClickCommand          = new CommandHandler(__RowDoubleClick, true);
            EnterExpectedDelayCommand     = new CommandHandler(__EnterExpectedDelay, false);
            ShowTrainScheduleCommand      = new CommandHandler(__ShowTrainSchedule, false);
            ShowTrackChangeCommand        = new CommandHandler(__ShowTrackChange, false);
            ShowLocalOrdersCommand        = new CommandHandler(__ShowLocalOrders, false);
            ShowDelayJustificationCommand = new CommandHandler(__ShowDelayJustification, false);
        }
Esempio n. 13
0
        public ChildWindow()
            : base()
        {
            CloseCommand         = new CommandHandler(Close, true);
            DockOutCommand       = new CommandHandler(__DockOut, true);
            SizeToContentCommand = new CommandHandler(__SizeToContent, true);

            Closed     += __Closed;
            WindowState = Xceed.Wpf.Toolkit.WindowState.Open;

            m_SettingsBll = new SettingsBLL();
            SetWindowColor();
        }
Esempio n. 14
0
        /// <summary>
        ///
        /// </summary>
        private static void SetCulture()
        {
            var settings = SettingsBLL.GetSetting();

            if (string.IsNullOrEmpty(settings.ReportingParameter.CultureName))
            {
                return;
            }
            CultureInfo cultureInfo = CultureInfo.GetCultureInfo(settings.ReportingParameter.CultureName);

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;
        }
Esempio n. 15
0
        /// <summary>
        /// Show Selection File Dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GenerateButtonClicked(object sender, RoutedEventArgs e)
        {
            ReportingVM _reportingVm = (DataContext as ReportingVM);

            if (_reportingVm == null)
            {
                return;
            }
            SaveFileDialog dialog = new SaveFileDialog
            {
                Filter = (_reportingVm.SelectedTemplateFile.Extension != ".xlsx") ?
                         string.Format("*{0}, *.pdf|*{0};*.pdf", _reportingVm.SelectedTemplateFile.Extension)
                    : string.Format("*{0}|*{0}", _reportingVm.SelectedTemplateFile.Extension),
                DefaultExt = _reportingVm.SelectedTemplateFile.Extension,
                FileName   = _reportingVm.SelectedTemplateFile.Name.Replace('-', ' ')
            };


            var settings = SettingsBLL.GetSetting();

            if (string.IsNullOrEmpty(settings.ReportingParameter.TemplatePath) || !Directory.Exists(settings.ReportingParameter.TemplatePath))
            {
                dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            }
            else
            {
                dialog.InitialDirectory = settings.ReportingParameter.GeneratedFilePath;
            }

            var result = dialog.ShowDialog();
            var _vm    = (ReportingVM)DataContext;

            if (result != null && result.Value)
            {
                settings.ReportingParameter.GeneratedFilePath = Path.GetDirectoryName(dialog.FileName);

                SettingsBLL.SaveSetting(settings);

                if (_vm != null)
                {
                    _vm.ReportFileName = dialog.FileName;
                }
            }
            else
            {
                if (_vm != null)
                {
                    _vm.ReportFileName = string.Empty;
                }
            }
        }
Esempio n. 16
0
        public TrainScheduleViewModel(Dispatcher Dispatcher, Train Train, Area Area)
            : base()
        {
            this.Dispatcher  = Dispatcher;
            CurrentTrain     = Train;
            m_CalculationBll = new CalculationBLL();
            m_SettingsBll    = new SettingsBLL();
            Stations         = new ObservableCollection <TrainScheduleStationViewModel>();

            if (Area != null)
            {
                Refresh(Area);
            }
        }
Esempio n. 17
0
        public SettingsScope()
        {
            m_SettingsBll = new SettingsBLL();

            var settingsResult = m_SettingsBll.GetSettings();

            if (settingsResult.Succeeded)
            {
                m_Settings         = settingsResult.Result;
                m_OriginalSettings = m_Settings.Clone();
                m_Settings.DelayJustificationEnabled = true;
                m_Settings.DelayJustificationMinutes = 3;
            }
        }
Esempio n. 18
0
        private void CheckThemeSettings()
        {
            var BLL      = new SettingsBLL();
            var settings = BLL.GetTheme();

            if (settings == "Dark")
            {
                this.RequestedTheme = ElementTheme.Dark;
            }
            else
            {
                this.RequestedTheme = ElementTheme.Light;
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Implement Add service Command
        /// </summary>
        public void SaveSettings()
        {
            SettingsBLL.SaveSetting(Setting);

            MessageManager.OnSettingsSaved();

            if (Thread.CurrentThread.CurrentCulture.Name.Equals(Setting.ReportingParameter.CultureName))
            {
                return;
            }
            Thread.CurrentThread.CurrentCulture   = Culture;
            Thread.CurrentThread.CurrentUICulture = Culture;

            LangageChanged?.Invoke(this, null);
        }
Esempio n. 20
0
        /// <summary>
        /// Implement Command that Load the templates list
        /// </summary>
        private void ExecuteLoadTemplatesCommand(object parameter)
        {
            switch (SelectedTab)
            {
            case 0:
                TemplateFiles = SettingsBLL.GetTemplateFileList();
                break;

            case 1:
                TemplateFiles = SettingsBLL.GetTemplateFileListPortfolio();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 21
0
        /// <summary>
        ///
        /// </summary>
        public App()
        {
#if !DEBUG
            this.DispatcherUnhandledException += OnDispatcherUnhandledException;
#endif
            LogHelper.SetPathLog(SettingsBLL.GetApplicationPath());

            if (string.IsNullOrEmpty(ViewModelBase.Setting.ReportingParameter.CultureName))
            {
                return;
            }
            CultureInfo cultureInfo = CultureInfo.GetCultureInfo(ViewModelBase.Setting.ReportingParameter.CultureName);

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;
        }
Esempio n. 22
0
        /// <summary>
        /// Implement Add service Command
        /// </summary>
        public void SaveSettings()
        {
            SettingsBLL.SaveSetting(Setting);

            base.MessageManager.OnSettingsSaved();

            if (!Thread.CurrentThread.CurrentCulture.Name.Equals(Setting.ReportingParameter.CultureName))
            {
                Thread.CurrentThread.CurrentCulture   = Culture;
                Thread.CurrentThread.CurrentUICulture = Culture;

                if (LangageChanged != null)
                {
                    LangageChanged(this, null);
                }
            }
        }
Esempio n. 23
0
        public ChildWindow(string Identifier)
            : base()
        {
            this.Identifier = Identifier;

            CloseCommand         = new CommandHandler(Close, true);
            SizeToContentCommand = new CommandHandler(__SizeToContent, true);

            DataContextChanged += __DataContextChanged;
            Closed             += __Closed;
            WindowState         = Xceed.Wpf.Toolkit.WindowState.Open;

            var SettingsBll    = new SettingsBLL();
            var SettingsResult = SettingsBll.GetSettings();

            if (SettingsResult.Succeeded)
            {
                WindowColor = SettingsResult.Result.WindowColor;
            }
        }
        public TrainProgressInformationViewModel(Dispatcher Dispatcher, Area area)
        {
            this.Dispatcher  = Dispatcher;
            Trains           = new ObservableCollection <TrainStationViewModel>();
            m_SettingsBll    = new SettingsBLL();
            m_CalculationBll = new CalculationBLL();
            m_Area           = area;
            m_Random         = new Random();

            m_DoubleClickCommand          = new CommandHandler(__RowDoubleClick, true);
            EnterExpectedDelayCommand     = new CommandHandler(__EnterExpectedDelay, false);
            ShowTrainScheduleCommand      = new CommandHandler(__ShowTrainSchedule, false);
            ShowTrackChangeCommand        = new CommandHandler(__ShowTrackChange, false);
            ShowLocalOrdersCommand        = new CommandHandler(__ShowLocalOrders, false);
            ShowTrainCompositionCommand   = new CommandHandler(__ShowTrainComposition, false);
            ShowDelayJustificationCommand = new CommandHandler(__ShowDelayJustification, false);
            NewTrainStateCommand          = new CommandHandler(__NewTrainState, true);
            EnterTrainStateCommand        = new CommandHandler(__EnterTrainState, false);
            NewCommand    = new CommandHandler(__NewEntry, true);
            DeleteCommand = new CommandHandler(__DeleteEntry, false);
        }
Esempio n. 25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            string showhelp;


            LogHelper.SetPathLog(SettingsBLL.GetApplicationPath());

            SetCulture();

            LogHelper.Instance.LogInfo("Application started.");

            Environment.ExitCode = DoWork(args, out showhelp);

            if (!string.IsNullOrEmpty(showhelp))
            {
                System.Console.WriteLine(showhelp);
            }

            // Uncomment if you want to see the console during debugging
            // System.Console.ReadLine();
        }
Esempio n. 26
0
        /// <summary>
        /// Implement Add service Command
        /// </summary>
        public void ExecuteAddCommand(WSConnection conn)
        {
            try
            {
                StatesEnum state;
                Setting = SettingsBLL.AddConnection(conn, false, out state);

                if (state == StatesEnum.ConnectionAddedAndActivated || state == StatesEnum.ConnectionAddedSuccessfully)
                {
                    WSConnections = new ObservableCollection <WSConnection>(Setting.WSConnections);

                    NewConnectionUrl = NewConnectionLogin = NewConnectionPassword = string.Empty;
                }

                MessageManager.OnServiceAdded(conn.Url, state);
            }
            catch (UriFormatException ex)
            {
                LogHelper.Instance.LogInfo(ex.Message);
                MessageManager.OnServiceAdded(NewConnectionUrl, StatesEnum.ServiceInvalid);
            }
        }
Esempio n. 27
0
        public SettingsViewModel(ObservableCollection <Area> areas)
        {
            m_Areas       = areas;
            m_SettingsBll = new SettingsBLL();
            Areas         = new ObservableCollection <AreaViewModel>();

            var SettingsResult = m_SettingsBll.GetSettings();

            if (SettingsResult.Succeeded)
            {
                m_Settings = SettingsResult.Result.Clone();
                __Initialize();
            }
            else
            {
                ShowMessage(SettingsResult);
            }

            m_SaveCommand       = new CommandHandler(__Save, false);
            m_CancelCommand     = new CommandHandler(__Cancel, true);
            m_EstwOnlineCommand = new CommandHandler(__BrowseEstwOnline, true);
        }
Esempio n. 28
0
        public override void BuildDocument()
        {
            var excelDoc = (SpreadsheetDocument)base.Package;
            var settings = SettingsBLL.GetSetting();

            string strFilePath     = settings.ReportingParameter.GeneratedFilePath;
            string strTemplatePath = settings.ReportingParameter.TemplatePath;
            string strTargetFile   = ReportData.FileName;


            string fileName = strFinalTempFile;

            //File.Copy(strTargetFile, fileName, true);

            if (strTargetFile != "")
            {
                BuildReportTemplateEFPFlexi(fileName);
            }
            else
            {
                throw new InvalidOperationException("Unable to file the Workbook");
            }
        }
Esempio n. 29
0
        public TrainScheduleViewModel(Dispatcher Dispatcher, Train Train, Area Area)
        {
            this.Dispatcher             = Dispatcher;
            CurrentTrain                = Train;
            m_Area                      = Area;
            m_LiveDataBll               = new LiveDataBLL();
            m_CalculationBll            = new CalculationBLL();
            m_SettingsBll               = new SettingsBLL();
            Stations                    = new ObservableCollection <TrainScheduleStationViewModel>();
            OpenTrainScheduleCommand    = new CommandHandler <int?>(__OpenTrainSchedule, true);
            EditCommand                 = new CommandHandler(__EnterEditMode, true);
            DelayJustificationCommand   = new CommandHandler(__ShowDelayJustificationWindow, false);
            ShowTrainCompositionCommand = new CommandHandler(__ShowTrainComposition, Train.Composition.IsNotNullOrWhiteSpace());
            CloseCommand                = new CommandHandler(OnCloseWindow, true);
            SaveCommand                 = new CommandHandler(__Save, true);
            CancelCommand               = new CommandHandler(__ExitEditMode, true);
            CancelTrainCommand          = new CommandHandler(__CancelTrain, true);

            if (Area != null)
            {
                Refresh(Area);
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Implement Add service Command
        /// </summary>
        private void ExecuteAddCommand(object prameter)
        {
            try
            {
                WSConnection conn = new WSConnection(NewConnectionUrl, NewConnectionLogin, NewConnectionPassword, string.Empty);

                StatesEnum state;
                Setting = SettingsBLL.AddConnection(conn, false, out state);

                if (state == StatesEnum.ConnectionAddedAndActivated || state == StatesEnum.ConnectionAddedSuccessfully)
                {
                    WSConnections = new ObservableCollection <WSConnection>(Setting.WSConnections);

                    NewConnectionUrl = NewConnectionLogin = NewConnectionPassword = string.Empty;
                }

                base.MessageManager.OnServiceAdded(conn.Url, state);
            }
            catch (UriFormatException ex)
            {
                base.MessageManager.OnServiceAdded(NewConnectionUrl, StatesEnum.ServiceInvalid);
            }
        }