Пример #1
0
        private void AddReferenceScript(object sender, EventArgs e)
        {
            Microsoft.Win32.OpenFileDialog openFileExplorer = new Microsoft.Win32.OpenFileDialog()
            {
                CheckFileExists  = true,
                CheckPathExists  = true,
                InitialDirectory = @"Documents",
                ShowReadOnly     = true,
                Filter           = "Lua Scripts (*.lua)|*.lua|All files (*.*)|*.*"
            };

            Nullable <bool> result = openFileExplorer.ShowDialog();

            if (result == true)
            {
                string newFilePath = openFileExplorer.FileName;
                int    newFileId   = FileManager.AddReference(newFilePath);

                //OLD	LuaFileView.Items.Add(LHregistry.getSimpleName(newFilePath));
                Label newLabelToAdd = new Label();
                newLabelToAdd.Content = LHregistry.getSimpleName(newFilePath);
                newLabelToAdd.Cursor  = Cursors.Hand;


                styleLabel(newLabelToAdd);
                LuaFileView.Items.Add(newLabelToAdd);
            }
        }
Пример #2
0
        public AdvancedMode()
        {
            InitializeComponent();

            LuaFileView.SelectionChanged += LuaFileView_SelectionChanged;
            FileManager.LoadAllFiles();

            inst      = this;
            Focusable = true;

            StartupValues val = LHregistry.GetStartupValues();

            //SimpleMode.LastFileOpened = val.LastSimpleFileSelected;
            textEditor.FontSize = val.StartFontSize;
            textEditor.Text     = "function Start()\n	print(\"preview\")\nend\n\n\n\n\n\n\n\n";
            LoadFileFromId(val.StartupFileId);

            textEditor.InputBindings.Add(
                new InputBinding(new SaveCommand(),
                                 new KeyGesture(Key.S, ModifierKeys.Control)
                                 ));
            textEditor.InputBindings.Add(
                new InputBinding(new LineToggleCommand(),
                                 new KeyGesture(Key.L, ModifierKeys.Control)
                                 ));
            textEditor.ShowLineNumbers = Convert.ToBoolean(val.ShowLineNumbers);

            //set file view to the listbox
            Listbox = LuaFileView;
            StyleLuaListbox();

            //get all the filenames from registry
            int len = LHregistry.GetAllFilenames().Length;

            for (int i = 0; i < len; i++)
            {
                Label  txtbox    = new Label();
                string wholePath = LHregistry.GetAllFilenames()[i];
                txtbox.Content = LHregistry.getSimpleName(wholePath);

                styleLabel(txtbox);
                txtbox.Foreground = white;
                txtbox.Background = transparent;

                LuaFileView.Items.Add(txtbox);
            }

            BypassTextChangedEvent = true;

            //Alle icoontjes
            PlusIcon.Source   = ImageSourceFromBitmap(LeHandUI.Properties.Resources.PALE_GREEN_AddIcon64x64);
            DeleteIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.WASHED_OUT_RED_DeleteIcon64x64);
            //RefreshIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.AQUA_RefreshIcon64x64);
            //AddReferenceIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.AddReference16x16);
            SaveIcon.Source    = ImageSourceFromBitmap(LeHandUI.Properties.Resources.SaveScript64x64);
            RunPrgmIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.StartScript64x64);
        }
Пример #3
0
 public static string[] FileNames()
 {
     if (MainWindow.Directory == null || !Directory.Exists(MainWindow.Directory + "Files"))
     {
         System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory);
         Registry.CurrentUser.OpenSubKey("Software\\LeHand", true).SetValue("Dir", AppDomain.CurrentDomain.BaseDirectory);
         MainWindow.Directory = AppDomain.CurrentDomain.BaseDirectory;
     }
     string[] outstr = Directory.GetFiles(MainWindow.Directory + "\\Files");
     for (int i = 0; i < outstr.Length; i++)
     {
         outstr[i] = LHregistry.getSimpleName(outstr[i]);
         outstr[i] = outstr[i].Split('.')[0];
     }
     return(outstr);
 }
Пример #4
0
        private void RefreshLuaScript()
        {
            List <string> LuaNames = new List <string>(LHregistry.GetAllFilenames());

            int currOpenedFileId = FileManager.currentLoadedIndex;


            for (int i = 0; i < LuaNames.Count; i++)
            {
                Label currLuaFileViewLabel = (Label)(LuaFileView.Items[i]);

                if (LuaNames[i] == (string)currLuaFileViewLabel.Content)
                {
                    continue;
                }
                else
                {
                    Label label = new Label();
                    label.Name    = "TxtBox" + i.ToString();
                    label.Content = LHregistry.getSimpleName(LuaNames[i]);

                    if (FileManager.isFileNotSaved[i])
                    {
                        label.Content += "*";
                    }

                    if (currOpenedFileId == i)
                    {
                        styleOpenedFileLabel(label);
                    }
                    else
                    {
                        styleLabel(label);
                    }
                    LuaFileView.Items.RemoveAt(i);
                    LuaFileView.Items.Insert(i, label);
                }
            }
            LuaFileView.Items.Refresh();
        }