Exemple #1
0
        private void UpdateJumpList()
        {
            var jumpList = JumpList.GetJumpList(Application.Current) ?? new JumpList();

            jumpList.ShowRecentCategory = true;

            // Remove JumpTasks for folders,which are not in the MRU list anymore
            //jumpList.JumpItems.RemoveAll(item => item is JumpTask && !_folders.Any(path => String.Equals(path, ((JumpTask)item).Title, StringComparison.OrdinalIgnoreCase)));

            // add JumpTasks for folders, which do not exist already
            foreach (var folder in _folders.Where(f => !jumpList.JumpItems.OfType <JumpTask>().Any(item => String.Equals(f, item.Title, StringComparison.OrdinalIgnoreCase))))
            {
                var jumpTask = new JumpTask {
                    ApplicationPath   = Assembly.GetExecutingAssembly().Location,
                    Arguments         = folder,
                    IconResourcePath  = @"C:\Windows\System32\shell32.dll",
                    IconResourceIndex = 3,
                    Title             = folder,
                    CustomCategory    = "Recent folders"
                };
                JumpList.AddToRecentCategory(jumpTask);
            }

            jumpList.Apply();
        }
Exemple #2
0
        public void PlayStation(Station station)
        {
            CurrentStation = station;
            JumpList.AddToRecentCategory(station.asJumpTask());

            RunTask(PlayThread);
        }
Exemple #3
0
        /// <summary>
        /// add an item to the W7+ jumplist
        /// </summary>
        /// <param name="fullpath">fully qualified path, can include '|' character for archives</param>
        public static void AddRecentItem(string fullpath)
        {
            string title;

            if (fullpath.Contains('|'))
            {
                title = fullpath.Split('|')[1];
            }
            else
            {
                title = Path.GetFileName(fullpath);
            }

            string exepath = Assembly.GetEntryAssembly().Location;

            var ji = new JumpTask
            {
                ApplicationPath = exepath,
                Arguments       = '"' + fullpath + '"',
                Title           = title,
                // for some reason, this doesn't work
                WorkingDirectory = Path.GetDirectoryName(exepath)
            };

            JumpList.AddToRecentCategory(ji);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var jt = new JumpTask
            {
                ApplicationPath = "C:\\Windows\\notepad.exe",
                Arguments       = "readme.txt",
                Title           = "Recent Entry for Notepad",
                CustomCategory  = "Dummy"
            };

            JumpList.AddToRecentCategory(jt);



            var jt2 = new JumpTask
            {
                ApplicationPath = "C:\\Windows\\notepad.exe",
                Arguments       = "readme.txt",
                Title           = "Code Entry for Notepad",
                CustomCategory  = "Dummy"
            };

            var currentJumplist = JumpList.GetJumpList(App.Current);

            currentJumplist.JumpItems.Add(jt2);
            currentJumplist.Apply();
        }
Exemple #5
0
        //--------------------------------------------------------------------------------------------------

        public void AddToMruList(string filePath)
        {
            var index = MruList.IndexOfFirst(s => s.CompareIgnoreCase(filePath) == 0);

            if (index >= 0)
            {
                // Move to top of list
                MruList.Move(index, 0);
                MruList[0] = filePath;
            }
            else
            {
                if (MruList.Count >= _MaxMruCount)
                {
                    MruList.RemoveAt(MruList.Count - 1);
                }

                MruList.Insert(0, filePath);
            }

            InteractiveContext.Current.SaveLocalSettings("MRU", MruList);

            try
            {
                JumpList.AddToRecentCategory(filePath);
            }
            catch
            {
                // ignored
            }
        }
Exemple #6
0
 public bool LoadController(string filename = null)
 {
     if (TLCGenControllerDataProvider.Default.OpenController(filename))
     {
         string lastfilename = TLCGenControllerDataProvider.Default.ControllerFileName;
         SetControllerForStatics(TLCGenControllerDataProvider.Default.Controller);
         ControllerVM.Controller = TLCGenControllerDataProvider.Default.Controller;
         Messenger.Default.Send(new ControllerFileNameChangedMessage(TLCGenControllerDataProvider.Default.ControllerFileName, lastfilename));
         Messenger.Default.Send(new UpdateTabsEnabledMessage());
         RaisePropertyChanged("ProgramTitle");
         RaisePropertyChanged("HasController");
         FileOpened?.Invoke(this, TLCGenControllerDataProvider.Default.ControllerFileName);
         var jumpTask = new JumpTask
         {
             Title     = Path.GetFileName(TLCGenControllerDataProvider.Default.ControllerFileName),
             Arguments = TLCGenControllerDataProvider.Default.ControllerFileName
         };
         JumpList.AddToRecentCategory(jumpTask);
         return(true);
     }
     if (filename != null)
     {
         FileOpenFailed?.Invoke(this, filename);
     }
     return(false);
 }
Exemple #7
0
        private static void UpdateJumpList(IEnumerable <string> args)
        {
            var arguments = ArgumentEscaper.EscapeAndConcatenate(args);

            JumpList.AddToRecentCategory(new JumpTask
            {
                Title     = arguments,
                Arguments = arguments
            });
        }
Exemple #8
0
        public void OpenPath(string filePath, string fileName = null)
        {
            CurrentNote = null;
            FilePath    = filePath;
            FileName    = fileName ?? Path.GetFileName(filePath);

            Notes = XmlUtils.LoadNotesFromXml(FilePath);
            Notes.CollectionChanged += NotesOnCollectionChanged;

            JumpList.AddToRecentCategory(FilePath);
        }
Exemple #9
0
        // Run lengthy processes asyncronously to improve UI responsiveness
        protected void Worker_DoWork(object s, DoWorkEventArgs args)
        {
            var parms = (BackgroundWorkerParams)args.Argument;

            args.Result = parms.Command;

            switch (parms.Command)
            {
            case "process":
                Engine.Process();
                break;

            case "openScript":
            {
                var fileName = parms.Arguments.First();
                Engine.LoadScript(fileName);
                JumpList.AddToRecentCategory(fileName);
                rootFolder = Path.GetDirectoryName(fileName);
                break;
            }

            case "openTrack":
            {
                var fileName = parms.Arguments.First();
                Engine.LoadFlightReport(Debriefer, fileName);
                break;
            }

            case "batchProcess":
            {
                var    n           = parms.Arguments.Count();
                string currentFile = null;
                var    i           = 0;
                try
                {
                    foreach (var fileName in parms.Arguments)
                    {
                        currentFile = fileName;
                        worker.ReportProgress(100 * i++ / n);
                        Engine.BatchProcess(Debriefer, fileName, rootFolder);
                    }
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("File " + currentFile + ": " + Environment.NewLine + ex.Message);
                }
                finally
                {
                    worker.ReportProgress(100);
                }
                break;
            }
            }
        }
        public void AddRecentProject(FileName name)
        {
            recentProjects.Remove(name);

            while (recentProjects.Count >= MAX_LENGTH)
            {
                recentProjects.RemoveAt(recentProjects.Count - 1);
            }

            recentProjects.Insert(0, name);
            JumpList.AddToRecentCategory(name);
            properties.SetList("Projects", recentProjects);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var di = new DirectoryInfo("C://");
            var jt = new JumpTask
            {
                ApplicationPath = "C:\\Windows\\notepad.exe",
                Arguments       = "C://",
                Description     = "Run at " + "C://",
                Title           = di.Name,
                CustomCategory  = "Hello World"
            };

            JumpList.AddToRecentCategory(jt);
        }
Exemple #12
0
        private void LoadTimingFile(string FilePath)
        {
            if (!File.Exists(FilePath))
            {
                string ErrorString = "Unable to load file \"" + FilePath + "\"";
                Console.WriteLine(ErrorString);
                MessageBox.Show(ErrorString + Environment.NewLine + "(File not found)",
                                "File Not Found",
                                MessageBoxButton.OK,
                                MessageBoxImage.Question);
                return;
            }

            JumpList.AddToRecentCategory(FilePath);

            try
            {
                TimingDataViewModel NewTimingData = TimingDataViewModel.FromBinaryFile(FileReference.FromString(FilePath));

                // If this is an aggregate, hook up the open commands for the file rows.
                if (NewTimingData.Type == UnrealBuildTool.TimingDataType.Aggregate)
                {
                    foreach (TimingDataViewModel File in NewTimingData.Children[0].Children.Cast <TimingDataViewModel>())
                    {
                        OpenTimingDataCommand FileOpenCommand = new OpenTimingDataCommand(File);
                        FileOpenCommand.OpenAction =
                            (ViewModel) =>
                        {
                            TimingDataViewModel FileTimingData = NewTimingData.LoadTimingDataFromBinaryBlob(File.Name);
                            Dispatcher.BeginInvoke(new Action(() => { AddTimingDataViewModelToTabs(FileTimingData); }));
                        };

                        File.OpenCommand = FileOpenCommand;
                    }
                }
                AddTimingDataViewModelToTabs(NewTimingData);
            }
            catch (System.IO.EndOfStreamException e)
            {
                string ErrorString = "Unable to load file \"" + FilePath + "\"";
                Console.WriteLine(ErrorString);
                Console.WriteLine(e.ToString());
                MessageBox.Show(ErrorString + Environment.NewLine + "(may be corrupted)",
                                "Error Loading Timing File",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
Exemple #13
0
        /// <summary>
        /// Adds the jump list task for the specified task name
        /// </summary>
        /// <param name="taskName">Name of the task.</param>
        /// <param name="description">The description.</param>
        /// <param name="argument">The argument.</param>
        private void AddJumpListTask(string taskName, string description, string argument)
        {
            // Configure a new JumpTask.
            JumpTask jumpTask1 = new JumpTask();
            string   path      = System.Reflection.Assembly.GetExecutingAssembly().Location;

            jumpTask1.ApplicationPath = path;
            jumpTask1.Title           = taskName;
            jumpTask1.Description     = description;
            jumpTask1.Arguments       = argument;
            JumpList jumpList1 = JumpList.GetJumpList(App.Current);

            jumpList1.JumpItems.Add(jumpTask1);
            JumpList.AddToRecentCategory(jumpTask1);
            jumpList1.Apply();
        }
Exemple #14
0
        private void OpenNewWindow(IEnumerable <string> args)
        {
            MainWindow newWnd     = null;
            string     fileToOpen = null;

            if (args != null && args.Count() > 0 && !string.IsNullOrWhiteSpace(args.First()))
            {
                fileToOpen = args.First();
                if (File.Exists(fileToOpen))
                {
                    JumpList.AddToRecentCategory(fileToOpen);
                }
            }
            if (mainWnd == null && fileToOpen != null)
            {
                newWnd = new MainWindow(fileToOpen);
                newWnd.Show();
            }
            else if (mainWnd == null)
            {
                newWnd = new MainWindow();
                newWnd.Show();
            }
            else if (fileToOpen != null && fileToOpen.Trim().StartsWith("-"))
            {
                mainWnd.CreateNewFile(fileToOpen);
            }
            else if (fileToOpen != null)
            {
                mainWnd.OpenFile(new L3dFilePath(fileToOpen));
            }
            else
            {
                if (mainWnd.WindowState == System.Windows.WindowState.Minimized)
                {
                    mainWnd.WindowState = System.Windows.WindowState.Normal;
                }
                mainWnd.Activate();
                //mainWnd.BringIntoView();
            }
            if (mainWnd == null)
            {
                mainWnd = newWnd;
            }
        }
Exemple #15
0
        public void AddLastProject(string name)
        {
            for (int i = 0; i < lastproject.Count; ++i)
            {
                if (lastproject[i].ToString().Equals(name, StringComparison.OrdinalIgnoreCase))
                {
                    lastproject.RemoveAt(i);
                }
            }

            while (lastproject.Count >= MAX_LENGTH)
            {
                lastproject.RemoveAt(lastproject.Count - 1);
            }

            lastproject.Insert(0, name);
            JumpList.AddToRecentCategory(name);
        }
Exemple #16
0
        public override void SaveDocumentAs(ITypeFactory factory)
        {
            XmlSerializer  seri = new XmlSerializer(new SerializationManager(), new DataContractSerializerFactory(), new XmlNamespaceManager(), factory, new ObjectAdapter());
            SaveFileDialog dlg  = new SaveFileDialog
            {
                Filter     = "Rodska Note Documents (.rndml)|*.rndml",
                FileName   = "Dialogue",
                DefaultExt = ".rndml"
            };
            bool?result = dlg.ShowDialog();

            if (result == true)
            {
                FileStream stream = new FileStream(dlg.FileName, FileMode.Create);
                seri.Serialize(this, stream);
                stream.Close();
                JumpList jl         = JumpList.GetJumpList(RodskaApplication.Current);
                bool     jpExisting = false;
                foreach (JumpItem item in jl.JumpItems)
                {
                    if (item is JumpPath)
                    {
                        JumpPath p = item as JumpPath;
                        if (p.Path == dlg.FileName)
                        {
                            jpExisting = true;
                            break;
                        }
                    }
                }
                if (!jpExisting)
                {
                    JumpPath jp = new JumpPath
                    {
                        Path           = dlg.FileName,
                        CustomCategory = Type
                    };
                    jl.JumpItems.Add(jp);
                    JumpList.AddToRecentCategory(jp);
                    jl.Apply();
                }
            }
        }
Exemple #17
0
        public override void SaveDocumentAs(ITypeFactory factory)
        {
            Catel.Runtime.Serialization.Xml.XmlSerializer seri = (Catel.Runtime.Serialization.Xml.XmlSerializer)SerializationFactory.GetXmlSerializer();
            SaveFileDialog dlg = new SaveFileDialog
            {
                Filter     = "Rodska Note Documents (.rndml)|*.rndml",
                FileName   = "ProgressionTree",
                DefaultExt = ".rndml"
            };
            bool?result = dlg.ShowDialog();

            if (result == true)
            {
                FileStream stream = new FileStream(dlg.FileName, FileMode.Create);
                this.Save(stream, seri);
                stream.Close();
                JumpList jl         = JumpList.GetJumpList(RodskaApplication.Current);
                bool     jpExisting = false;
                foreach (JumpItem item in jl.JumpItems)
                {
                    if (item is JumpPath)
                    {
                        JumpPath p = item as JumpPath;
                        if (p.Path == dlg.FileName)
                        {
                            jpExisting = true;
                            break;
                        }
                    }
                }
                if (!jpExisting)
                {
                    JumpPath jp = new JumpPath
                    {
                        Path           = dlg.FileName,
                        CustomCategory = Type
                    };
                    jl.JumpItems.Add(jp);
                    JumpList.AddToRecentCategory(jp);
                    jl.Apply();
                }
            }
        }
Exemple #18
0
        public void Load(string fileName, SerializationFormat serializationFormat = SerializationFormat.CompressedBinary)
        {
            var evt = ObjectSerializer <Event> .Load(fileName, serializationFormat);

            Name          = evt.name;
            ShortName     = evt.ShortName;
            LocationDates = evt.LocationDates;
            Director      = evt.Director;
            Competitions  = evt.Competitions;
            Pilots        = evt.Pilots;
            Tasks         = evt.Tasks;

            FilePath = fileName;

            RaisePropertyChanged("OutputVisibility");
            isNew   = false;
            IsDirty = false;

            JumpList.AddToRecentCategory(fileName);
        }
Exemple #19
0
        public void AddPath(string path)
        {
            if (string.IsNullOrEmpty(path) || !Directory.Exists(path))
            {
                return;
            }

            JumpList jumpList = JumpList.GetJumpList(Application.Current) ?? new JumpList();

            JumpTask jumpTask = new JumpTask
            {
                Title            = GetTitle(path),
                ApplicationPath  = ProgramInfo.GetInstallFilePath(),
                Arguments        = GetOpenArguments(path),
                IconResourcePath = ProgramInfo.GetInstallFilePath(),
                Description      = path
            };

            jumpList.ShowRecentCategory = true;
            JumpList.AddToRecentCategory(jumpTask);
            JumpList.SetJumpList(Application.Current, jumpList);
        }
Exemple #20
0
        // <snippet240>
        private void AddTask(object sender, RoutedEventArgs e)
        {
            // <snippet241>
            // Configure a new JumpTask.
            JumpTask jumpTask1 = new JumpTask();

            // Get the path to Calculator and set the JumpTask properties.
            jumpTask1.ApplicationPath  = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86), "calc.exe");
            jumpTask1.IconResourcePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86), "calc.exe");
            jumpTask1.Title            = "Calculator";
            jumpTask1.Description      = "Open Calculator.";
            jumpTask1.CustomCategory   = "User Added Tasks";
            // </snippet241>
            // <snippet242>
            // Get the JumpList from the application and update it.
            JumpList jumpList1 = JumpList.GetJumpList(App.Current);

            jumpList1.JumpItems.Add(jumpTask1);
            JumpList.AddToRecentCategory(jumpTask1);
            jumpList1.Apply();
            // </snippet242>
        }
Exemple #21
0
        private static void AddSelectedProjectToJumpList(Project selectedProject)
        {
            JumpTask task = new JumpTask
            {
                Title            = selectedProject.Name,
                Arguments        = selectedProject.Name,
                Description      = "Open with " + selectedProject.Name + " selected",
                IconResourcePath = InstallDirectory + "SwitcherIcon_w1.ico", //Assembly.GetEntryAssembly().CodeBase,
                ApplicationPath  = Assembly.GetEntryAssembly().CodeBase
            };

            JumpList jl = JumpList.GetJumpList(App.Current);

            if (jl == null)
            {
                jl = new JumpList();
            }

            //jl.JumpItems.Add(task);
            //JumpList.SetJumpList(App.Current, jl);
            JumpList.AddToRecentCategory(task);
            jl.Apply();
        }
Exemple #22
0
        public static void AddToRecentDocuments(String Filename)
        {
            // Create custom task
            JumpTask item = new JumpTask();

            item.Title           = System.IO.Path.GetFileName(Filename);
            item.Description     = Filename;
            item.ApplicationPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
            item.Arguments       = Filename;
            item.CustomCategory  = "Tasks";


            // Add document to recent category
            JumpList RecentsDocs = JumpList.GetJumpList(Application.Current);

            RecentsDocs.JumpItems.Add(item);
            JumpList.AddToRecentCategory(item);
            RecentsDocs.Apply();

            // Store a copy in application settings, ring buffer style
            Dependencies.Properties.Settings.Default.RecentFiles[Dependencies.Properties.Settings.Default.RecentFilesIndex] = Filename;
            Dependencies.Properties.Settings.Default.RecentFilesIndex = (byte)((Dependencies.Properties.Settings.Default.RecentFilesIndex + 1) % Dependencies.Properties.Settings.Default.RecentFiles.Count);
        }
Exemple #23
0
        public static void AddToRecentDocuments(String Filename)
        {
            // Create custom task
            JumpTask item = new JumpTask();

            item.Title           = System.IO.Path.GetFileName(Filename);
            item.Description     = Filename;
            item.ApplicationPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
            item.Arguments       = Filename;
            item.CustomCategory  = "Tasks";


            // Add document to recent category
            JumpList RecentsDocs = JumpList.GetJumpList(Application.Current);

            RecentsDocs.JumpItems.Add(item);
            JumpList.AddToRecentCategory(item);
            RecentsDocs.Apply();

            // Store a copy in application settings, LRU style
            // First check if the item is not already present in the list
            int index = Dependencies.Properties.Settings.Default.RecentFiles.IndexOf(Filename);

            if (index != -1)
            {
                Dependencies.Properties.Settings.Default.RecentFiles.RemoveAt(index);
            }

            // Second check if the list is not full
            if (Dependencies.Properties.Settings.Default.RecentFiles.Count == 10)
            {
                Dependencies.Properties.Settings.Default.RecentFiles.RemoveAt(9);
            }

            // Prepend the list with the new item
            Dependencies.Properties.Settings.Default.RecentFiles.Insert(0, Filename);
        }
Exemple #24
0
        private void UpdateRecent(bool insert = true)
        {
            if (insert)
            {
                if (set.Default.Recent.Contains(path))
                {
                    set.Default.Recent.Remove(path);
                }
                set.Default.Recent.Insert(0, path);
                SaveSettings();
            }
            var v = set.Default.Recent.Cast <string>().ToList();

            foreach (string s in v)
            {
                if (!System.IO.File.Exists(s) && set.Default.Recent.Contains(s))
                {
                    set.Default.Recent.Remove(s);
                }
            }
            while (set.Default.Recent.Count > 10)
            {
                set.Default.Recent.RemoveAt(set.Default.Recent.Count - 1);
            }

            JumpList.GetJumpList(App.Current).JumpItems.Clear();
            foreach (string s in set.Default.Recent)
            {
                JumpPath p = new JumpPath()
                {
                    Path = s
                };
                JumpList.AddToRecentCategory(p);
            }
            JumpList.GetJumpList(App.Current).Apply();
        }
 protected virtual void AddToRecentCategoryOverride(string path)
 {
     JumpList.AddToRecentCategory(path);
 }
Exemple #26
0
        /// <summary>Edit the selected project or update.</summary>
        internal static void EditItem()
        {
            ResetPages();
            IsNewProject = false;

            if (File.Exists(Path.Combine(App.UserStore, Projects[AppIndex].ApplicationName + ".sua")))
            {
                AppInfo =
                    Utilities.Deserialize <Sua>(Path.Combine(App.UserStore, Projects[AppIndex].ApplicationName + ".sua"));
            }
            else
            {
                AppInfo    = null;
                UpdateInfo = null;
                ShowMessage(
                    string.Format(
                        CultureInfo.CurrentUICulture,
                        Resources.FileLoadError,
                        Path.Combine(App.UserStore, Projects[AppIndex].ApplicationName + ".sua")),
                    TaskDialogStandardIcon.Error);
                return;
            }

            if (UpdateIndex < 0)
            {
                MainWindow.NavService.Navigate(AppInfoPage);
                return;
            }

            if (File.Exists(Path.Combine(App.UserStore, Projects[AppIndex].ApplicationName + @".sui")))
            {
                UpdateInfo =
                    Utilities.Deserialize <Collection <Update> >(
                        Path.Combine(App.UserStore, Projects[AppIndex].ApplicationName + ".sui"))[UpdateIndex];
            }
            else
            {
                AppInfo    = null;
                UpdateInfo = null;
                ShowMessage(
                    string.Format(
                        CultureInfo.CurrentUICulture,
                        Resources.FileLoadError,
                        Path.Combine(App.UserStore, Projects[AppIndex].ApplicationName + ".sui")),
                    TaskDialogStandardIcon.Error);
                return;
            }

            var jumpTask = new JumpTask
            {
                IconResourcePath =
                    Path.Combine(Directory.GetParent(Utilities.AppDir).FullName, "Shared", @"SevenUpdate.Base.dll"),
                IconResourceIndex = 8,
                Title             = Utilities.GetLocaleString(UpdateInfo.Name),
                Arguments         = @"-edit " + AppIndex + " " + UpdateIndex
            };

            JumpList.AddToRecentCategory(jumpTask);

            MainWindow.NavService.Navigate(UpdateInfoPage);
        }
 internal void AddFilenameToRecent(string filename)
 {
     JumpList.AddToRecentCategory(new JumpPath {
         Path = filename
     });
 }
 public override void AddToRecentCategory(string fileName)
 {
     JumpList.AddToRecentCategory(fileName);
 }
Exemple #29
0
 public override void AddRecentProject(FileName name)
 {
     base.AddRecentProject(name);
     JumpList.AddToRecentCategory(name);
 }
Exemple #30
0
        private void JumpPath_AddToRecent(object sender, RoutedEventArgs e)
        {
            JumpPath jp = GenerateJumpPath();

            JumpList.AddToRecentCategory(jp);
        }