예제 #1
0
파일: LibraryView.cs 프로젝트: ye-man/M3D
 public override void OnUpdate()
 {
     if (recorddata_to_load != null && currentTab != null)
     {
         currentTab.LoadRecord(recorddata_to_load);
         recorddata_to_load = null;
     }
     if (viewstate == ViewState.ToActive || viewstate == ViewState.ToHidden)
     {
         elapsed = DateTime.Now.Ticks / 10000L - startTime;
         if (elapsed >= realanimtiontime || X == (double)target_x)
         {
             elapsed   = realanimtiontime;
             viewstate = viewstate != ViewState.ToActive ? ViewState.Hidden : ViewState.Active;
         }
         var num = target_x - (target_x - RelativeX) * (float)(1.0 - elapsed / (double)realanimtiontime);
         RelativeX = num;
         ShowView(num < 1.0);
     }
     if (refresh.Value)
     {
         RefreshTab();
         refresh.Value = false;
     }
     base.OnUpdate();
 }
예제 #2
0
        public void RemoveRecord(LibraryRecord record)
        {
            if (!(record is RecentPrintsHistory.PrintHistory))
            {
                return;
            }

            recentPrintsHistory.RemoveRecord((RecentPrintsHistory.PrintHistory)record);
        }
예제 #3
0
 public void LoadRecord(LibraryRecord record)
 {
     if (!string.IsNullOrEmpty(record.cachefilename))
     {
         model_loading_manager.LoadModelIntoPrinter(record, new ModelLoadingManager.LoadFailedCallback(OnLoadFailure));
     }
     else
     {
         libraryData.RemoveFileFromRecent(record.ID);
         libraryView.ScheduleRefresh();
         infobox.AddMessageToQueue("Unable to load model from previous software.");
     }
 }
예제 #4
0
        public void LoadRecord(LibraryRecord record)
        {
            var flag = false;

            if (record is RecentPrintsHistory.PrintHistory printHistory)
            {
                if (Directory.Exists(printHistory.folder))
                {
                    model_loading_manager.LoadPrinterView(Path.Combine(printHistory.folder, "printerview.xml"), Path.Combine(printHistory.folder, "printersettings.xml"), printHistory.folder, "313a13a6-9edf-44c7-a81d-50b914e423cc-6bb0e036-df11-4d66-82b3-8b7f0de03d2c");
                    flag = true;
                }
            }
            if (flag)
            {
                return;
            }

            RemoveRecord(record);
        }
예제 #5
0
        public void SaveRecord(LibraryRecord record)
        {
            if (!(record is RecentPrintsHistory.PrintHistory))
            {
                return;
            }

            var printHistory   = (RecentPrintsHistory.PrintHistory)record;
            var str            = "Untitled.zip";
            var saveFileDialog = new SaveFileDialog
            {
                FileName     = str,
                DefaultExt   = ".zip",
                AddExtension = true,
                Filter       = "Zip (*.zip)|*.zip"
            };

            if (saveFileDialog.ShowDialog() != DialogResult.OK || !RecentPrintsHistory.SavePrintHistoryToZip(saveFileDialog.FileName, printHistory))
            {
                return;
            }

            libraryView.RecentModels.CopyAndAssignIconForLibrary(saveFileDialog.FileName, printHistory.iconfilename);
        }
예제 #6
0
 public void SaveRecord(LibraryRecord record)
 {
 }
예제 #7
0
 public void RemoveRecord(LibraryRecord record)
 {
     libraryData.RemoveFileFromRecent(record.ID);
 }
예제 #8
0
 public LibraryRecord(LibraryRecord other)
 {
     ID = other.ID;
 }
예제 #9
0
파일: LibraryView.cs 프로젝트: ye-man/M3D
        public override void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
        {
            switch (msg)
            {
            case ControlMsg.MSG_MOVE:
                if (currentTab.CanRemoveRecords)
                {
                    var childElement = (ImageWidget)FindChildElement(1008);
                    if (childElement != null)
                    {
                        childElement.Visible = true;
                    }
                }
                if (!currentTab.CanSaveRecords)
                {
                    break;
                }

                var childElement1 = (ImageWidget)FindChildElement(1009);
                if (childElement1 == null)
                {
                    break;
                }

                childElement1.Visible = true;
                break;

            case ControlMsg.ENTERHIT:
                if (the_control.GetElementType() != ElementType.EditBoxWidget)
                {
                    break;
                }

                var editBoxWidget = (EditBoxWidget)the_control;
                if (editBoxWidget.ID != 1001)
                {
                    break;
                }

                search_filter = editBoxWidget.Text;
                RefreshTab();
                break;

            case ControlMsg.MSG_DRAGSTOP:
                var childElement2 = (ImageWidget)FindChildElement(1008);
                var childElement3 = (ImageWidget)FindChildElement(1009);
                if (the_control.GetElementType() == ElementType.ButtonWidget)
                {
                    var buttonWidget = (ButtonWidget)the_control;
                    if (buttonWidget.Data != null && buttonWidget.Data is LibraryRecord)
                    {
                        if (currentTab.CanRemoveRecords && buttonWidget.Overlaps(childElement2, (int)xparam - buttonWidget.X_Abs, (int)yparam - buttonWidget.Y_Abs))
                        {
                            currentTab.RemoveRecord((LibraryRecord)buttonWidget.Data);
                            refresh.Value = true;
                        }
                        else if (currentTab.CanSaveRecords && buttonWidget.Overlaps(childElement3, (int)xparam - buttonWidget.X_Abs, (int)yparam - buttonWidget.Y_Abs))
                        {
                            currentTab.SaveRecord((LibraryRecord)buttonWidget.Data);
                            refresh.Value = true;
                        }
                        else
                        {
                            recorddata_to_load = (LibraryRecord)buttonWidget.Data;
                        }
                    }
                }
                if (childElement2 != null)
                {
                    childElement2.Visible = false;
                }

                if (childElement3 == null)
                {
                    break;
                }

                childElement3.Visible = false;
                break;

            default:
                base.OnControlMsg(the_control, msg, xparam, yparam);
                break;
            }
        }