Ejemplo n.º 1
0
        private void LoadLogic()
        {
            if (InitLogic())
            {
#if APP_RELEASE
                _update = new UpdateCheck();
                if (_config.Fields.Elpis_CheckUpdates)
                {
                    _loadingPage.UpdateStatus("Checking for updates...");
                    if (_update.CheckForUpdate())
                    {
                        this.BeginDispatch(() =>
                        {
                            _updatePage = new UpdatePage(_update);
                            _updatePage.UpdateSelectionEvent += _updatePage_UpdateSelectionEvent;
                            transitionControl.AddPage(_updatePage);
                            transitionControl.ShowPage(_updatePage);
                        });
                    }
                    else
                    {
                        FinalLoad();
                    }
                }
                else
                {
                    FinalLoad();
                }
#else
                FinalLoad();
#endif
            }
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            InitializeComponent();

            openFileDialogGCode.FileOk     += OpenFileDialogGCode_FileOk;
            saveFileDialogGCode.FileOk     += SaveFileDialogGCode_FileOk;
            openFileDialogHeightMap.FileOk += OpenFileDialogHeightMap_FileOk;
            saveFileDialogHeightMap.FileOk += SaveFileDialogHeightMap_FileOk;

            machine.ConnectionStateChanged += Machine_ConnectionStateChanged;

            machine.NonFatalException += Machine_NonFatalException;
            machine.Info           += Machine_Info;
            machine.LineReceived   += Machine_LineReceived;
            machine.LineReceived   += settingsWindow.LineReceived;
            machine.StatusReceived += Machine_StatusReceived;
            machine.LineSent       += Machine_LineSent;

            machine.PositionUpdateReceived += Machine_PositionUpdateReceived;
            machine.StatusChanged          += Machine_StatusChanged;
            machine.DistanceModeChanged    += Machine_DistanceModeChanged;
            machine.UnitChanged            += Machine_UnitChanged;
            machine.PlaneChanged           += Machine_PlaneChanged;
            machine.BufferStateChanged     += Machine_BufferStateChanged;
            machine.OperatingModeChanged   += Machine_OperatingMode_Changed;
            machine.FileChanged            += Machine_FileChanged;
            machine.FilePositionChanged    += Machine_FilePositionChanged;
            machine.ProbeFinished          += Machine_ProbeFinished;
            machine.OverrideChanged        += Machine_OverrideChanged;
            machine.PinStateChanged        += Machine_PinStateChanged;

            Machine_OperatingMode_Changed();
            Machine_PositionUpdateReceived();

            Properties.Settings.Default.SettingChanging += Default_SettingChanging;
            FileRuntimeTimer.Tick += FileRuntimeTimer_Tick;

            machine.ProbeFinished += Machine_ProbeFinished_UserOutput;

            LoadMacros();

            settingsWindow.SendLine += machine.SendLine;

            machine.Calculator.GetGCode += () => ToolPath;

            CheckBoxUseExpressions_Changed(null, null);
            ButtonRestoreViewport_Click(null, null);

            UpdateCheck.CheckForUpdate();

            if (App.Args.Length > 0)
            {
                if (File.Exists(App.Args[0]))
                {
                    openFileDialogGCode.FileName = App.Args[0];
                    OpenFileDialogGCode_FileOk(null, null);
                }
            }
        }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();

            openFileDialogGCode.FileOk     += OpenFileDialogGCode_FileOk;
            openFileDialogHeightMap.FileOk += OpenFileDialogHeightMap_FileOk;
            saveFileDialogHeightMap.FileOk += SaveFileDialogHeightMap_FileOk;

            machine.ConnectionStateChanged += Machine_ConnectionStateChanged;

            machine.NonFatalException += Machine_NonFatalException;
            machine.Info         += Machine_Info;
            machine.LineReceived += Machine_LineReceived;
            machine.LineSent     += Machine_LineSent;

            machine.PositionUpdateReceived += Machine_PositionUpdateReceived;
            machine.StatusChanged          += Machine_StatusChanged;
            machine.DistanceModeChanged    += Machine_DistanceModeChanged;
            machine.UnitChanged            += Machine_UnitChanged;
            machine.PlaneChanged           += Machine_PlaneChanged;
            machine.BufferStateChanged     += Machine_BufferStateChanged;
            machine.OperatingModeChanged   += UpdateAllButtons;
            machine.FileChanged            += Machine_FileChanged;
            machine.FilePositionChanged    += Machine_FilePositionChanged;
            machine.ProbeFinished          += Machine_ProbeFinished;

            UpdateAllButtons();

            UpdateCheck.CheckForUpdate();
        }
Ejemplo n.º 4
0
        public void Initialize()
        {
            // Setup the update handler
            InitializeUpdate();

            // Show the notification icon
            NotificationIcon.Initialize(this);

            // Load window settings
            LoadWindowSettings();

            // Set the foreground color to something that can be seen
            LinkTextList.Foreground = (System.Drawing.SystemColors.Desktop.GetBrightness() < 0.5) ? Brushes.White : Brushes.Black;
            HeaderLabel.Foreground  = LinkTextList.Foreground;

            // Create the background worker that does the actual reading
            _feedReadWorker = new BackgroundWorker {
                WorkerReportsProgress = true, WorkerSupportsCancellation = true
            };
            _feedReadWorker.DoWork             += HandleFeedReadWorkerStart;
            _feedReadWorker.ProgressChanged    += HandleFeedReadWorkerProgressChanged;
            _feedReadWorker.RunWorkerCompleted += HandleFeedReadWorkerCompleted;

            // Setup the database
            _database = new FeedCenterEntities();

            // Initialize the command line listener
            _commandLineListener = new InterprocessMessageListener(Properties.Resources.ApplicationName);
            _commandLineListener.MessageReceived += HandleCommandLine;

            // Handle any command line we were started with
            HandleCommandLine(null, new InterprocessMessageListener.InterprocessMessageEventArgs(Environment.CommandLine));

            // Create a timer to keep track of things we need to do
            InitializeTimer();

            // Initialize the feed display
            InitializeDisplay();

            // Check for update
            if (Settings.Default.CheckVersionAtStartup)
            {
                UpdateCheck.CheckForUpdate();
            }

            // Show the link if updates are available
            if (UpdateCheck.UpdateAvailable)
            {
                NewVersionLink.Visibility = Visibility.Visible;
            }

            Tracer.WriteLine("MainForm creation finished");
        }
Ejemplo n.º 5
0
        public MainWindow()
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            InitializeComponent();

            openFileDialogGCode.FileOk     += OpenFileDialogGCode_FileOk;
            saveFileDialogGCode.FileOk     += SaveFileDialogGCode_FileOk;
            openFileDialogHeightMap.FileOk += OpenFileDialogHeightMap_FileOk;
            saveFileDialogHeightMap.FileOk += SaveFileDialogHeightMap_FileOk;

            machine.ConnectionStateChanged += Machine_ConnectionStateChanged;

            machine.NonFatalException += Machine_NonFatalException;
            machine.Info           += Machine_Info;
            machine.LineReceived   += Machine_LineReceived;
            machine.LineReceived   += settingsWindow.LineReceived;
            machine.JogCanceled    += Controls_JogCanceled;
            machine.StatusReceived += Machine_StatusReceived;
            machine.LineSent       += Machine_LineSent;

            machine.PositionUpdateReceived += Machine_PositionUpdateReceived;
            machine.StatusChanged          += Machine_StatusChanged;
            machine.DistanceModeChanged    += Machine_DistanceModeChanged;
            machine.UnitChanged            += Machine_UnitChanged;
            machine.PlaneChanged           += Machine_PlaneChanged;
            machine.BufferStateChanged     += Machine_BufferStateChanged;
            machine.OperatingModeChanged   += Machine_OperatingMode_Changed;
            machine.FileChanged            += Machine_FileChanged;
            machine.FilePositionChanged    += Machine_FilePositionChanged;
            machine.ProbeFinished          += Machine_ProbeFinished;
            machine.OverrideChanged        += Machine_OverrideChanged;
            machine.PinStateChanged        += Machine_PinStateChanged;

            Machine_OperatingMode_Changed();
            Machine_PositionUpdateReceived();

            Properties.Settings.Default.SettingChanging += Default_SettingChanging;
            FileRuntimeTimer.Tick += FileRuntimeTimer_Tick;

            machine.ProbeFinished += Machine_ProbeFinished_UserOutput;

            LoadMacros();

            settingsWindow.SendLine += machine.SendLine;

            CheckBoxUseExpressions_Changed(null, null);

            UpdateCheck.CheckForUpdate();
        }
Ejemplo n.º 6
0
        private async void MainWin_Loaded(object sender, RoutedEventArgs e)
        {
            var result = await UpdateCheck.CheckForUpdate();

            if (result.Succes)
            {
                ShowDialog(new UpdateCheck(result.Latest));
            }
            else if (result.Error)
            {
                MessageBox.Show(Properties.Resources.UpdateCheck_Error,
                                Properties.Resources.Error_Title,
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
Ejemplo n.º 7
0
        public MainWindow()
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            InitializeComponent();

            openFileDialogGCode.FileOk     += OpenFileDialogGCode_FileOk;
            saveFileDialogGCode.FileOk     += SaveFileDialogGCode_FileOk;
            openFileDialogHeightMap.FileOk += OpenFileDialogHeightMap_FileOk;
            saveFileDialogHeightMap.FileOk += SaveFileDialogHeightMap_FileOk;

            machine.ConnectionStateChanged += Machine_ConnectionStateChanged;

            machine.NonFatalException += Machine_NonFatalException;
            machine.Info         += Machine_Info;
            machine.LineReceived += Machine_LineReceived;
            machine.LineSent     += Machine_LineSent;

            machine.PositionUpdateReceived += Machine_PositionUpdateReceived;
            machine.StatusChanged          += Machine_StatusChanged;
            machine.DistanceModeChanged    += Machine_DistanceModeChanged;
            machine.UnitChanged            += Machine_UnitChanged;
            machine.PlaneChanged           += Machine_PlaneChanged;
            machine.BufferStateChanged     += Machine_BufferStateChanged;
            machine.OperatingModeChanged   += Machine_OperatingMode_Changed;
            machine.FileChanged            += Machine_FileChanged;
            machine.FilePositionChanged    += Machine_FilePositionChanged;
            machine.ProbeFinished          += Machine_ProbeFinished;

            Machine_OperatingMode_Changed();

            Properties.Settings.Default.SettingChanging += Default_SettingChanging;

            LoadMacros();

            UpdateCheck.CheckForUpdate();
        }
Ejemplo n.º 8
0
        public MainWindow()
        {
            log4net.Config.XmlConfigurator.Configure();
            _log.Info("Starting SPIPware");

            AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            InitializeComponent();


            UpdatePlateCheckboxes(true);
            //LoadDefaults();
            //UpdatePlateCheckboxes();
            //cycle.UpdatePositionList(checkBoxes);


            peripheral.PeripheralUpdate += UpdatePeripheralStatus;
            cycle.StatusUpdate          += UpdateCycleStatus;
            timelapse.TimeLapseStatus   += UpdateTimeLapseStatus;
            cycle.ImageUpdatedEvent     += UpdatePictureBox;
            timelapse.ExperimentStatus  += ExperimentUpdated;

            updateSerialPortComboBox(PeripheralSerialPortSelect);
            updateSerialPortComboBox(SerialPortSelect);
            updateCameraSettingsOptions();
            //UpdateClrCanvas();
            Properties.Settings.Default.tlStartDate = DateTime.Now;

            Task task = new Task(() => camera.StartVimba());

            task.ContinueWith(ExceptionHandler, TaskContinuationOptions.OnlyOnFaulted);
            task.Start();
            //camera.StartVimba();
            Task task2 = new Task(() => UpdateCheck.CheckForUpdate());

            task2.ContinueWith(ExceptionHandler, TaskContinuationOptions.OnlyOnFaulted);
            task2.Start();

            machine.ConnectionStateChanged += Machine_ConnectionStateChanged;

            machine.NonFatalException += Machine_NonFatalException;
            machine.Info           += Machine_Info;
            machine.LineReceived   += Machine_LineReceived;
            machine.LineReceived   += settingsWindow.LineReceived;
            machine.StatusReceived += Machine_StatusReceived;
            machine.LineSent       += Machine_LineSent;

            machine.PositionUpdateReceived += Machine_PositionUpdateReceived;
            machine.StatusChanged          += Machine_StatusChanged;
            machine.DistanceModeChanged    += Machine_DistanceModeChanged;
            machine.UnitChanged            += Machine_UnitChanged;
            machine.PlaneChanged           += Machine_PlaneChanged;
            machine.BufferStateChanged     += Machine_BufferStateChanged;
            machine.OperatingModeChanged   += Machine_OperatingMode_Changed;
            //machine.FileChanged += Machine_FileChanged;
            //machine.FilePositionChanged += Machine_FilePositionChanged;
            //machine.ProbeFinished += Machine_ProbeFinished;
            machine.OverrideChanged += Machine_OverrideChanged;
            machine.PinStateChanged += Machine_PinStateChanged;

            Machine_OperatingMode_Changed();
            Machine_PositionUpdateReceived();

            Properties.Settings.Default.SettingChanging += Default_SettingChanging;
            FileRuntimeTimer.Tick += FileRuntimeTimer_Tick;

            machine.ProbeFinished += Machine_ProbeFinished_UserOutput;

            settingsWindow.SendLine += machine.SendLine;

            CheckBoxUseExpressions_Changed(null, null);
            //updatePlateCheckboxes();

            //cameraControl.m_CameraList = m_CameraList;
            camera.m_PictureBox = m_PictureBox;
        }
Ejemplo n.º 9
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if ((bool)SettingsInstance["ShowPlaylistEditorOnStartup"].Value)
            {
                InstanceManager.Instance.PlaylistEditorInstance.Show();
            }

            // Set the initial scrolling animation
            SetTextScrollingAnimation(MainLabel.Text);

            // Init PluginWidget
            PlWidget = new PluginsWidget(this, PluginsButton, Widget.WidgetRelativePosition.Above,
                                         Widget.WidgetAlignment.Center, false, true);

            // Load plugin GUIs:
            foreach (var p in InstanceManager.Instance.LoadedExtensions)
            {
                p.Instance.InitGui();
            }

            // Debug
            //MessageBox.Show("Actual size: " + playButtonImage.ActualHeight + "*" + playButtonImage.ActualWidth);

            // Open the file specified in CLArgs. If failed, open the autoload playlist if enabled
            if (!FileSystemUtils.LoadFileFromClArgs() && (bool)SettingsInstance["LoadPlaylistOnStartup"].Value)
            {
                var f = (string)SettingsInstance["PlaylistToAutoLoad"].Value;
                if (File.Exists(f))
                {
                    PlaybackManagerInstance.Playlist.AddRange(f, FileSystemUtils.DefaultLoadErrorCallback);
                }
                else
                {
                    MessageBox.Show("File not found: " + f,
                                    "Non-critical error, everything is ok!", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                }
            }

            try
            {
                // Update Checking
                if (!(bool)SettingsInstance["CheckForUpdates"].Value)
                {
                    return;
                }
                var upd = await UpdateCheck.CheckForUpdate();

                if (upd == "")
                {
                    return;
                }
                var result = MessageBox.Show("A new version of Sky Jukebox is available! Download the update now?",
                                             "Update Checker", MessageBoxButton.YesNo, MessageBoxImage.Information);
                if (result == MessageBoxResult.Yes)
                {
                    Process.Start("https://github.com/OronDF343/Sky-Jukebox/releases");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Ejemplo n.º 10
0
        private static void HandleFeedReadWorkerStart(object sender, DoWorkEventArgs e)
        {
            // Create a new database instance for just this thread
            var database = new FeedCenterEntities();

            // Get the worker
            var worker = (BackgroundWorker)sender;

            // Get the input information
            var workerInput = (FeedReadWorkerInput)e.Argument;

            // Setup for progress
            var currentProgress = 0;

            // Create the list of feeds to read
            var feedsToRead = new List <Feed>();

            // If we have a single feed then add it to the list - otherwise add them all
            if (workerInput.Feed != null)
            {
                feedsToRead.Add(database.Feeds.First(feed => feed.ID == workerInput.Feed.ID));
            }
            else
            {
                feedsToRead.AddRange(database.Feeds);
            }

            // Loop over each feed and read it
            foreach (var feed in feedsToRead)
            {
                // Read the feed
                feed.Read(database, workerInput.ForceRead);

                // Increment progress
                currentProgress += 1;

                // Report progress
                worker.ReportProgress(currentProgress);
            }

            // Save the changes
            database.SaveChanges();

            // Increment progress
            currentProgress += 1;

            // Report progress
            worker.ReportProgress(currentProgress);

            // See if we're due for a version check
            if (DateTime.Now - Settings.Default.LastVersionCheck >= Settings.Default.VersionCheckInterval)
            {
                // Get the update information
                UpdateCheck.CheckForUpdate();

                // Update the last check time
                Settings.Default.LastVersionCheck = DateTime.Now;
            }

            // Increment progress
            currentProgress += 1;

            // Report progress
            worker.ReportProgress(currentProgress);

            // Sleep for a little bit so the user can see the update
            Thread.Sleep(Settings.Default.ProgressSleepInterval * 3);
        }
Ejemplo n.º 11
0
 private void UpdateThread()
 {
     UpdateCheck.CheckForUpdate();
 }