Пример #1
0
        public void RecreateAllPanels(object state = null)
        {
            if (Width == 0)
            {
                return;
            }

            int numberOfPanels = NumberOfVisiblePanels();

            PreChangePanels.CallEvents(this, null);
            RemovePanelsAndCreateEmpties();

            switch (numberOfPanels)
            {
            case 1:
                ApplicationController.Instance.WidescreenMode = false;
                LoadCompactView();
                break;

            case 2:
                ApplicationController.Instance.WidescreenMode = false;
                LoadCompactView();
                LoadColumnTwo();
                break;
            }

            SetColumnVisibility();

            lastNumberOfVisiblePanels = numberOfPanels;
        }
Пример #2
0
 private void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (downloadSize > 0)
     {
         this.downloadPercent = (int)(e.BytesReceived * 100 / downloadSize);
     }
     UiThread.RunOnIdle(() => UpdateStatusChanged.CallEvents(this, e));
 }
Пример #3
0
        public void RecreateAllPanels(object state = null)
        {
            if (Width == 0)
            {
                return;
            }

            int numberOfPanels = NumberOfVisiblePanels();

            if (LeftBorderLine != null)
            {
                leftBorderLineHiden  = LeftBorderLine.Hidden;
                rightBorderLineHiden = RightBorderLine.Hidden;
            }
            PreChangePanels.CallEvents(this, null);
            RemovePanelsAndCreateEmpties();

            switch (numberOfPanels)
            {
            case 1:
                ApplicationController.Instance.WidescreenMode = false;
                LoadCompactView();
                break;

#if NEW_TWO_COLUMN_MODE
            case 2:
                ApplicationController.Instance.WidescreenMode = false;
                LoadCompactView();
                LoadColumnTwo();
                LoadColumnThree();
                break;
#else
            case 2:
#endif

            case 3:
                ApplicationController.Instance.WidescreenMode = true;

                LoadColumnOne();
                // make sure we restore the state of column one because LoadColumnThree is going to save it.
                LoadColumnTwo();
                LoadColumnThree();
                break;
            }

            LeftBorderLine.Hidden  = leftBorderLineHiden;
            RightBorderLine.Hidden = rightBorderLineHiden;
            SetColumnVisibility();
            RightBorderLine.SetDisplayState();
            LeftBorderLine.SetDisplayState();

            lastNumberOfVisiblePanels = numberOfPanels;
        }
Пример #4
0
        void OnSettingsChanged()
        {
            //Set hash code back to 0
            this.settingsHashCode = 0;

            SettingsChanged.CallEvents(this, null);
        }
Пример #5
0
        private void DoReloadAll(GuiWidget drawingWidget, DrawEventArgs e)
        {
            UiThread.RunOnIdle(() =>
            {
                if (MainView != null)
                {
                    using (new QuickTimer($"ReloadAll_{reloadCount++}:"))
                    {
                        // give the widget a chance to hear about the close before they are actually closed.
                        PopOutManager.SaveIfClosed = false;
                        WidescreenPanel.PreChangePanels.CallEvents(this, null);
                        MainView?.CloseAllChildren();
                        using (new QuickTimer("ReloadAll_AddElements"))
                        {
                            MainView?.AddElements();
                        }
                        PopOutManager.SaveIfClosed = true;
                        DoneReloadingAll?.CallEvents(null, null);
                    }

                    MainView.AfterDraw  -= DoReloadAll;
                    pendingReloadRequest = false;
                }
            });
        }
Пример #6
0
        internal void ClearHistory()
        {
            string query = string.Format("DELETE FROM PrintTask;");

            DataStorage.Datastore.Instance.dbSQLite.ExecuteScalar <DataStorage.PrintTask>(query);
            HistoryCleared.CallEvents(this, null);
        }
Пример #7
0
        private string KeepTrackOfPostionAndDestination(string lineBeingSent)
        {
            if (lineBeingSent.StartsWith("G0 ") || lineBeingSent.StartsWith("G1 "))
            {
                Vector3 newDestination = currentDestination;
                if (PrinterConnectionAndCommunication.Instance.MovementMode == PrinterMachineInstruction.MovementTypes.Relative)
                {
                    newDestination = Vector3.Zero;
                }

                GCodeFile.GetFirstNumberAfter("X", lineBeingSent, out newDestination.x);
                GCodeFile.GetFirstNumberAfter("Y", lineBeingSent, out newDestination.y);
                GCodeFile.GetFirstNumberAfter("Z", lineBeingSent, out newDestination.z);

                GCodeFile.GetFirstNumberAfter("E", lineBeingSent, out currentExtruderDestination);
                GCodeFile.GetFirstNumberAfter("F", lineBeingSent, out currentFeedRate);

                if (PrinterConnectionAndCommunication.Instance.MovementMode == PrinterMachineInstruction.MovementTypes.Relative)
                {
                    newDestination += currentDestination;
                }

                if (currentDestination != newDestination)
                {
                    currentDestination = newDestination;
                    DestinationChanged.CallEvents(this, null);
                }
            }

            return(lineBeingSent);
        }
Пример #8
0
 public void OnFileHasChanged()
 {
     if (FileHasChanged != null)
     {
         FileHasChanged.CallEvents(this, null);
     }
 }
Пример #9
0
        private static void Profiles_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // Any time the list changes, persist the updates to disk
            Instance.Save();

            ProfilesListChanged.CallEvents(null, null);
        }
Пример #10
0
 private static void OnThemeChanged()
 {
     if (!suppressNotification)
     {
         ThemeChanged?.CallEvents(null, null);
     }
 }
Пример #11
0
 void OnHasChanged(EventArgs e)
 {
     HasChanged.CallEvents(this, e);
     if (PrinterLines.Count > maxLinesToBuffer)
     {
         Clear();
     }
 }
Пример #12
0
        public void OnSlicingOutputMessage(EventArgs e)
        {
            StringEventArgs message = e as StringEventArgs;

            if (SlicingOutputMessage != null)
            {
                SlicingOutputMessage.CallEvents(this, message);
            }
        }
Пример #13
0
        public void OnFileHasChanged()
        {
            // Get the hashcode so we can save it if it has changed.
            long fileHashCode = FileHashCode;

            if (FileHasChanged != null)
            {
                FileHasChanged.CallEvents(this, null);
            }
        }
Пример #14
0
        private static void Profiles_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // Any time the list changes, persist the updates to disk
            Instance.Save();

            ProfilesListChanged.CallEvents(null, null);

            // Force sync after any collection change event
            ApplicationController.SyncPrinterProfiles?.Invoke("ProfileManager.Profiles_CollectionChanged()", null);
        }
        public async Task AddItemAsync(string fileName, string fileLocation, bool fireDataReloaded)
        {
            if (!string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(fileLocation))
            {
                await Task.Run(() => AddStlOrGcode(fileLocation, fileName));
            }

            LoadLibraryItems();

            ItemAdded.CallEvents(this, null);
        }
        public void AddItem(string fileName, string fileLocation)
        {
            if (!string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(fileLocation))
            {
                AddStlOrGcode(fileLocation, fileName);
            }

            LoadLibraryItems();

            ItemAdded.CallEvents(this, null);
        }
Пример #17
0
        public static void OnSettingChanged(string slicerConfigName)
        {
            SettingChanged.CallEvents(null, new StringEventArgs(slicerConfigName));

            SliceSettingData settingsData;

            if (settingsByName.TryGetValue(slicerConfigName, out settingsData) && settingsData.ReloadUiWhenChanged)
            {
                UiThread.RunOnIdle(ApplicationController.Instance.ReloadAll);
            }
        }
Пример #18
0
 public void ReloadAll(object sender, EventArgs e)
 {
     UiThread.RunOnIdle((state) =>
     {
         // give the widget a chance to hear about the close before they are actually colsed.
         WidescreenPanel.PreChangePanels.CallEvents(this, null);
         MainView.CloseAndRemoveAllChildren();
         MainView.AddElements();
         if (DoneReloadingAll != null)
         {
             DoneReloadingAll.CallEvents(null, null);
         }
     });
 }
Пример #19
0
        public override void OnLoad(EventArgs args)
        {
            if (!pluginsQueuedToAdd && printer.Settings.GetValue(SettingsKey.include_firmware_updater) == "Simple Arduino")
            {
                UiThread.RunOnIdle(() =>
                {
                    AddPluginControls.CallEvents(this, null);
                    pluginsQueuedToAdd = false;
                });
                pluginsQueuedToAdd = true;
            }

            base.OnLoad(args);
        }
Пример #20
0
        public void RecreateAllPanels(object state = null)
        {
            if (Width == 0)
            {
                return;
            }

            int numberOfPanels = this.VisiblePanelCount;

            PreChangePanels.CallEvents(this, null);
            RemovePanelsAndCreateEmpties();

            LoadCompactView();

            // Load ColumnTwo if applicable - i.e. widescreen view
            if (numberOfPanels == 2)
            {
                LoadColumnTwo();
            }

            SetColumnVisibility();

            lastNumberOfVisiblePanels = numberOfPanels;
        }
Пример #21
0
        public override void AddChild(GuiWidget childToAdd, int indexInChildrenList = -1)
        {
            FlowLayoutWidget itemHolder = new FlowLayoutWidget();

            itemHolder.Name    = "LB item holder";
            itemHolder.Margin  = new BorderDouble(0, 0, 0, 0);
            itemHolder.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
            itemHolder.AddChild(childToAdd);
            itemHolder.VAnchor = VAnchor.FitToChildren;
            topToBottomItemList.AddChild(itemHolder, indexInChildrenList);

            AddItemHandlers(itemHolder);

            ItemAdded.CallEvents(this, new GuiWidgetEventArgs(childToAdd));
        }
        public async void AddItem(string fileName, string fileLocation)
        {
            await Task.Run(() =>
            {
                if (!string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(fileLocation))
                {
                    AddStlOrGcode(fileLocation, fileName);
                }

                UiThread.RunOnIdle(() =>
                {
                    LoadLibraryItems();

                    ItemAdded.CallEvents(this, null);
                });
            });
        }
Пример #23
0
        public void ChangeCloudSyncStatus(bool userAuthenticated, string reason = "")
        {
            UserSettings.Instance.set(UserSettingsKey.CredentialsInvalid, userAuthenticated ? "false" : "true");
            UserSettings.Instance.set(UserSettingsKey.CredentialsInvalidReason, userAuthenticated ? "" : reason);

            CloudSyncStatusChanged.CallEvents(this, new CloudSyncEventArgs()
            {
                IsAuthenticated = userAuthenticated
            });

            // Only fire UserChanged if it actually happened - prevents runaway positive feedback loop
            if (AuthenticationData.Instance.ActiveSessionUsername != AuthenticationData.Instance.LastSessionUsername)
            {
                AuthenticationData.Instance.LastSessionUsername = AuthenticationData.Instance.ActiveSessionUsername;
                UserChanged();
            }
        }
 public void ReloadAll(object sender, EventArgs e)
 {
     UiThread.RunOnIdle(() =>
     {
         using (new PerformanceTimer("ReloadAll", "Total"))
         {
             // give the widget a chance to hear about the close before they are actually closed.
             PopOutManager.SaveIfClosed = false;
             WidescreenPanel.PreChangePanels.CallEvents(this, null);
             MainView.CloseAllChildren();
             using (new PerformanceTimer("ReloadAll", "AddElements"))
             {
                 MainView.AddElements();
             }
             PopOutManager.SaveIfClosed = true;
             DoneReloadingAll?.CallEvents(null, null);
         }
     });
 }
        public void ChangeCloudSyncStatus(bool userAuthenticated)
        {
            CloudSyncStatusChanged.CallEvents(this, new CloudSyncEventArgs()
            {
                IsAuthenticated = userAuthenticated
            });

            string activeUserName = ApplicationController.Instance.GetSessionUsernameForFileSystem();

            string currentUserName = UserSettings.Instance.get("ActiveUserName");

            UserSettings.Instance.set("ActiveUserName", activeUserName);

            // Only fire UserChanged if it actually happened - prevents runaway positive feedback loop
            if (currentUserName != activeUserName)
            {
                UserChanged();
            }
        }
        private async void AddItem(string fileName, string fileLocation)
        {
            await Task.Run(() =>
            {
                if (!string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(fileLocation))
                {
                    using (var stream = File.OpenRead(fileLocation))
                    {
                        AddItem(stream, Path.GetExtension(fileLocation).ToUpper(), fileName);
                    }
                }

                UiThread.RunOnIdle(() =>
                {
                    LoadLibraryItems();

                    ItemAdded.CallEvents(this, null);
                });
            });
        }
Пример #27
0
        public void DoPrintLeveling(bool doLeveling)
        {
            // Early exit if already set
            if (doLeveling == this.GetValue <bool>("print_leveling_enabled"))
            {
                return;
            }

            layeredProfile.SetValue("print_leveling_enabled", doLeveling ? "1" : "0");

            DoPrintLevelingChanged.CallEvents(this, null);

            if (doLeveling)
            {
                PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData();
                PrintLevelingPlane.Instance.SetPrintLevelingEquation(
                    levelingData.SampledPosition0,
                    levelingData.SampledPosition1,
                    levelingData.SampledPosition2,
                    ActiveSliceSettings.Instance.GetValue <Vector2>(SettingsKey.print_center));
            }
        }
Пример #28
0
        public void DoPrintLeveling(bool doLeveling)
        {
            // Early exit if already set
            if (doLeveling == this.DoPrintLeveling())
            {
                return;
            }

            layeredProfile.SetActiveValue("MatterControl.PrintLevelingEnabled", doLeveling ? "1" : "0");

            DoPrintLevelingChanged.CallEvents(this, null);

            if (doLeveling)
            {
                PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData();
                PrintLevelingPlane.Instance.SetPrintLevelingEquation(
                    levelingData.SampledPosition0,
                    levelingData.SampledPosition1,
                    levelingData.SampledPosition2,
                    ActiveSliceSettings.Instance.PrintCenter());
            }
        }
Пример #29
0
 public void OnItemAdded(EventArgs e)
 {
     ItemAdded.CallEvents(this, e);
 }
Пример #30
0
 public void OnItemRemoved(EventArgs e)
 {
     ItemRemoved.CallEvents(this, e);
 }