Ejemplo n.º 1
0
        private void JumpPath_AddToCategory(object sender, RoutedEventArgs e)
        {
            JumpPath jp = GenerateJumpPath();
            var      jl = JumpList.GetJumpList(Application.Current);

            jl.JumpItems.Add(jp);
            if (!DeferApply)
            {
                jl.Apply();
            }
        }
Ejemplo n.º 2
0
 private static IShellItem2 CreateItemFromJumpPath(JumpPath jumpPath)
 {
     try
     {
         return(JumpList.GetShellItemForPath(Path.GetFullPath(jumpPath.Path)));
     }
     catch (Exception)
     {
     }
     return(null);
 }
Ejemplo n.º 3
0
    /// <summary>
    /// 更新到下一步  by吴江
    /// </summary>
    void NewStepInit()
    {
        if (textJumpPathList.Count <= 0)
        {
            return;
        }
        startTime   = Time.time;
        curJumpPath = textJumpPathList[0];
        curDuration = curJumpPath.durationRate * totalTime;
        curFrom     = transform.position;
//        curScale = transform.localScale;
    }
Ejemplo n.º 4
0
    private static object GetShellObjectForJumpItem(JumpItem jumpItem)
    {
        JumpPath jumpPath = jumpItem as JumpPath;
        JumpTask jumpTask = jumpItem as JumpTask;

        if (jumpPath != null)
        {
            return(JumpList.CreateItemFromJumpPath(jumpPath));
        }
        if (jumpTask != null)
        {
            return(JumpList.CreateLinkFromJumpTask(jumpTask, true));
        }
        return(null);
    }
Ejemplo n.º 5
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            //register file extension
            RegisterHandler();

            //get jump list
            JumpList jumpList = JumpList.GetJumpList(Application.Current);

            JumpTask jumpTaskBaidu = new JumpTask();

            jumpTaskBaidu.ApplicationPath   = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "");
            jumpTaskBaidu.Description       = "Open baidu in new window";
            jumpTaskBaidu.Title             = "Baidu";
            jumpTaskBaidu.WorkingDirectory  = Environment.CurrentDirectory;
            jumpTaskBaidu.Arguments         = "baidu";
            jumpTaskBaidu.IconResourcePath  = jumpTaskBaidu.ApplicationPath;
            jumpTaskBaidu.IconResourceIndex = 0;
            jumpList.JumpItems.Add(jumpTaskBaidu);

            JumpTask jumpTaskGoogle = new JumpTask();

            jumpTaskGoogle.ApplicationPath  = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "");
            jumpTaskGoogle.Description      = "Open google in new window";
            jumpTaskGoogle.Title            = "Google";
            jumpTaskGoogle.WorkingDirectory = Environment.CurrentDirectory;
            jumpTaskGoogle.Arguments        = "google";
            jumpTaskBaidu.IconResourcePath  = jumpTaskBaidu.ApplicationPath;
            jumpTaskBaidu.IconResourceIndex = 0;
            jumpList.JumpItems.Add(jumpTaskGoogle);

            JumpPath jumpPathGithub = new JumpPath();

            jumpPathGithub.CustomCategory = "Common";
            jumpPathGithub.Path           = Environment.CurrentDirectory + "\\github.zturl";
            jumpList.JumpItems.Add(jumpPathGithub);

            JumpList.SetJumpList(Application.Current, jumpList);

            JumplistDemo.MainWindow mainWindow = new MainWindow(e.Args);
            Application.Current.MainWindow = mainWindow;
            mainWindow.ShowActivated       = true;
            mainWindow.Show();
        }
Ejemplo n.º 6
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();
                }
            }
        }
Ejemplo n.º 7
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();
                }
            }
        }
Ejemplo n.º 8
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();
        }
Ejemplo n.º 9
0
        private void JumpPath_AddToRecent(object sender, RoutedEventArgs e)
        {
            JumpPath jp = GenerateJumpPath();

            JumpList.AddToRecentCategory(jp);
        }
Ejemplo n.º 10
0
 public static void AddToRecentCategory(JumpPath jumpPath)
 {
     Verify.IsNotNull <JumpPath>(jumpPath, "jumpPath");
     JumpList.AddToRecentCategory(jumpPath.Path);
 }